/* ==========================================================================
   Pawgenda shared styles. Built ONLY from tokens.css variables.
   Scoped .razor.css owns a component's own layout; this file owns the shared
   vocabulary (buttons, fields, cards, pills, tables, alerts, shells).
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }
/* hidden means hidden, even on things with their own display (buttons, cards). Scripts rely on it. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; scroll-padding-top: 72px; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--pg-font);
  font-size: var(--pg-body-size);
  line-height: var(--pg-body-leading);
  color: var(--pg-ink);
  background: var(--pg-mist);
  -webkit-font-smoothing: antialiased;
  /* Never overflow hidden here: on iPhone it makes the body the scroller, and fixed bars (the tab bar) then drift
     up the screen as Safari's address bar shrinks. Sideways overflow is clipped on the app frame instead. */
}

h1, h2, h3, h4 {
  font-weight: var(--pg-heading-weight);
  letter-spacing: var(--pg-heading-tracking);
  line-height: 1.15;
  margin: 0 0 var(--pg-1);
  color: var(--pg-ink);
}
h1 { font-size: var(--pg-h1); }
h2 { font-size: var(--pg-h2); }
h3 { font-size: var(--pg-h3); }
p { margin: 0 0 var(--pg-2); }

a { color: var(--pg-brand); text-underline-offset: 2px; }
a:hover { color: var(--pg-brand-strong); }

:focus-visible { outline: 3px solid color-mix(in srgb, var(--pg-brand) 45%, transparent); outline-offset: 2px; }
/* Blazor focuses the page's h1 after each navigation (for screen readers); that's not a keyboard focus to draw. */
h1:focus, h1:focus-visible { outline: none; }

.muted, .text-muted { color: var(--pg-slate); }
.small { font-size: var(--pg-small); }
.tiny { font-size: var(--pg-tiny); }
.mono { font-variant-numeric: tabular-nums; letter-spacing: 0.04em; }
.kicker {
  font-size: var(--pg-tiny); font-weight: 700; color: var(--pg-slate);
  text-transform: none; letter-spacing: 0;
}
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---- Logo ---------------------------------------------------------------- */
.pg-logo { font-weight: 800; letter-spacing: -0.03em; color: var(--pg-ink); text-decoration: none; line-height: 1; }
.pg-logo .dot { color: var(--pg-buoy); }

/* ---- Buttons ------------------------------------------------------------- */
/* .btn-main  = Buoy: the ONE main action on a screen.
   .btn-brand = the brand colour (Sea, or the business's colour).
   .btn-quiet = outline, for everything else. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--pg-1);
  min-height: var(--pg-tap); padding: 0 var(--pg-3);
  font: inherit; font-weight: 700; font-size: var(--pg-body-size); line-height: 1;
  border: 1.5px solid transparent; border-radius: var(--pg-radius-control);
  background: var(--pg-white); color: var(--pg-ink);
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease, transform .1s ease;
}
.btn:active:not(:disabled) { transform: scale(.98); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn-main { background: var(--pg-buoy); color: var(--pg-on-buoy); }
.btn-main:hover { background: var(--pg-buoy-strong); color: var(--pg-on-buoy); }
.btn-brand { background: var(--pg-brand); color: var(--pg-on-brand); }
.btn-brand:hover { background: var(--pg-brand-strong); color: var(--pg-on-brand); }
.btn-quiet { background: var(--pg-white); border-color: var(--pg-line); color: var(--pg-ink); }
.btn-quiet:hover { border-color: var(--pg-slate); color: var(--pg-ink); }
.btn-danger { background: var(--pg-white); border-color: var(--pg-buoy); color: var(--pg-buoy); }
.btn-danger:hover { background: var(--pg-danger-tint); color: var(--pg-buoy); }
.btn-link { background: none; border: 0; padding: 0; min-height: var(--pg-tap); color: var(--pg-brand); font-weight: 600; }
.btn-sm { min-height: 40px; padding: 0 14px; font-size: var(--pg-small); }
@media (pointer: coarse) { .btn-sm { min-height: var(--pg-tap); } }   /* 44px tap targets on touch screens */
.btn-lg { min-height: 52px; }
.btn-block, .w-100 { width: 100%; }

/* ---- Fields -------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--pg-2); }
.field label, .form-label, .control-label { font-weight: 600; font-size: var(--pg-small); color: var(--pg-ink); }
.field .hint { font-size: var(--pg-tiny); color: var(--pg-slate); }
/* Form controls must be allowed to shrink: flex and grid items default to their content's width, and time/date/select
   controls have a wide one, so without this they push out of narrow cards. */
.field { min-width: 0; }
.input, .form-control, select, textarea { min-width: 0; max-width: 100%; }
input[type="time"], input[type="date"] { -webkit-appearance: none; appearance: none; }
.input, .form-control, select, textarea {
  width: 100%; min-height: var(--pg-tap); padding: 10px 14px;
  font: inherit; color: var(--pg-ink); background: var(--pg-white);
  border: 1.5px solid var(--pg-line); border-radius: var(--pg-radius-control);
}
textarea { min-height: 96px; resize: vertical; }
.input:focus, .form-control:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--pg-brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--pg-brand) 18%, transparent);
}
.input::placeholder, .form-control::placeholder { color: color-mix(in srgb, var(--pg-slate) 70%, white); }
.input[aria-invalid="true"], .form-control.invalid { border-color: var(--pg-buoy); }
.check { display: flex; align-items: flex-start; gap: 10px; min-height: var(--pg-tap); padding-top: 10px; cursor: pointer; }
.check input, .form-check-input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--pg-brand); flex: none; }
.form-check { display: flex; align-items: flex-start; gap: 10px; margin-bottom: var(--pg-2); }
.form-check-label { font-size: var(--pg-small); }

/* Identity template compatibility: floating labels become stacked labels. */
.form-floating { display: flex; flex-direction: column-reverse; gap: 6px; margin-bottom: var(--pg-2); }
.form-floating > .text-danger { order: -1; }
.text-danger, .validation-message { color: var(--pg-buoy); font-size: var(--pg-tiny); font-weight: 600; }
.text-success { color: var(--pg-success); }
.validation-summary-errors ul, ul.validation-errors { margin: 0 0 var(--pg-2); padding-left: 18px; color: var(--pg-buoy); font-size: var(--pg-small); }

/* ---- Cards & panels ------------------------------------------------------ */
.card {
  background: var(--pg-white); border: 1px solid var(--pg-line);
  border-radius: var(--pg-radius-card); padding: var(--pg-3);
}
.card + .card { margin-top: var(--pg-2); }
:is(.grid-2, .grid-3, .grid-4) > .card + .card { margin-top: 0; }   /* side by side: the grid gap does the spacing */
.card-tight { padding: var(--pg-2); }
.panel-sand { background: var(--pg-sand); border-radius: var(--pg-radius-card); padding: var(--pg-3); }
.stack > * + * { margin-top: var(--pg-2); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--pg-2); flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--pg-2); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--pg-2); }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--pg-2); }

/* ---- Stat tile ----------------------------------------------------------- */
.stat { background: var(--pg-white); border: 1px solid var(--pg-line); border-radius: var(--pg-radius-card); padding: var(--pg-2) var(--pg-3); }
.stat .label { font-size: var(--pg-tiny); color: var(--pg-slate); font-weight: 600; }
.stat .value { font-size: 28px; font-weight: 800; letter-spacing: var(--pg-heading-tracking); line-height: 1.2; }
.stat .sub { font-size: var(--pg-tiny); color: var(--pg-slate); }

/* ---- Pills --------------------------------------------------------------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px;
  border-radius: var(--pg-radius-pill); font-size: var(--pg-tiny); font-weight: 700;
  background: var(--pg-mist); color: var(--pg-slate); border: 1px solid var(--pg-line); white-space: nowrap;
}
.pill-brand { background: var(--pg-brand-tint); color: var(--pg-brand-strong); border-color: var(--pg-brand-line); }
.pill-good { background: var(--pg-success-tint); color: var(--pg-success); border-color: transparent; }
.pill-warn { background: var(--pg-sand); color: var(--pg-ink); border-color: transparent; }
.pill-bad { background: var(--pg-danger-tint); color: var(--pg-buoy); border-color: transparent; }

/* ---- Alerts -------------------------------------------------------------- */
.alert {
  padding: 12px var(--pg-2); border-radius: var(--pg-radius-control); margin-bottom: var(--pg-2);
  border: 1px solid var(--pg-line); background: var(--pg-white); font-size: var(--pg-small);
}
.alert-info { background: var(--pg-brand-tint); border-color: var(--pg-brand-line); }
.alert-warning { background: var(--pg-sand); border-color: transparent; }
.alert-danger { background: var(--pg-danger-tint); border-color: color-mix(in srgb, var(--pg-buoy) 30%, white); color: var(--pg-ink); }
.alert-success { background: var(--pg-success-tint); border-color: transparent; }

/* ---- Tables (become cards under 700px, as in Certra) -------------------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--pg-line); border-radius: var(--pg-radius-card); background: var(--pg-white); }
table.table { width: 100%; border-collapse: collapse; font-size: var(--pg-small); }
table.table th { text-align: left; font-size: var(--pg-tiny); color: var(--pg-slate); font-weight: 700; padding: 12px var(--pg-2); border-bottom: 1px solid var(--pg-line); background: var(--pg-mist); }
table.table td { padding: 12px var(--pg-2); border-bottom: 1px solid var(--pg-line); vertical-align: middle; }
table.table tr:last-child td { border-bottom: 0; }
table.table a { font-weight: 600; }

/* ---- Tabs ---------------------------------------------------------------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--pg-line); margin-bottom: var(--pg-3); overflow-x: auto; }
.tabs a, .tabs button {
  min-height: var(--pg-tap); padding: 0 var(--pg-2); display: inline-flex; align-items: center;
  font: inherit; font-weight: 600; color: var(--pg-slate); text-decoration: none; background: none;
  border: 0; border-bottom: 2.5px solid transparent; cursor: pointer; white-space: nowrap;
}
.tabs .active { color: var(--pg-ink); border-bottom-color: var(--pg-brand); }

/* ---- Dialogs: <Modal> (interactive) and <Sheet> / the "More" menu (static popover) ------------------------------
   One look everywhere: a bottom sheet on a phone, a centred card on a desktop. Never hand-roll an overlay. */
.dialog-backdrop {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: var(--pg-2);
  background: rgba(16, 38, 58, .45); animation: dlg-fade .15s ease-out;
}
.dialog {
  display: flex; flex-direction: column; width: 100%; max-width: 520px; max-height: calc(100dvh - 48px);
  margin: 0; padding: 0; border: 0; color: var(--pg-ink);
  background: var(--pg-white); border-radius: var(--pg-radius-card); box-shadow: var(--pg-shadow-2);
  animation: dlg-pop .18s ease-out; outline: none;
}
.dialog-wide { max-width: 720px; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: var(--pg-2); padding: var(--pg-2) var(--pg-2) 0 var(--pg-3); }
.dialog-head h2 { margin: 0; font-size: var(--pg-h3); }
.dialog-close {
  display: inline-grid; place-items: center; width: var(--pg-tap); height: var(--pg-tap); flex: none;
  border: 0; border-radius: 50%; background: none; color: var(--pg-slate); cursor: pointer;
}
.dialog-close:hover { background: var(--pg-mist); color: var(--pg-ink); }
.dialog-body { padding: var(--pg-2) var(--pg-3) var(--pg-3); overflow-y: auto; overscroll-behavior: contain; }
.dialog-foot {
  display: flex; justify-content: flex-end; gap: var(--pg-1); flex-wrap: wrap;
  padding: var(--pg-2) var(--pg-3) calc(var(--pg-2) + env(safe-area-inset-bottom));
  border-top: 1px solid var(--pg-line);
}
/* Static popover version: the browser handles open/close and the backdrop. */
.dialog[popover] { position: fixed; inset: 0; margin: auto; height: fit-content; }
.dialog[popover]:not(:popover-open) { display: none; }
.dialog[popover]::backdrop { background: rgba(16, 38, 58, .45); }
html:has(.dialog-backdrop), html:has(.dialog:popover-open) { overflow: hidden; }

@media (max-width: 700px) {
  .dialog-backdrop { place-items: end stretch; padding: 0; }
  .dialog, .dialog[popover] {
    max-width: none; max-height: 90dvh; border-radius: var(--pg-radius-card) var(--pg-radius-card) 0 0;
    animation: dlg-up .22s cubic-bezier(.2, .8, .2, 1);
  }
  .dialog[popover] { inset: auto 0 0 0; width: 100%; margin: 0; }
  .dialog-head::before {
    content: ""; position: absolute; left: 50%; top: 8px; width: 40px; height: 4px; margin-left: -20px;
    border-radius: var(--pg-radius-pill); background: var(--pg-line);
  }
  .dialog-head { position: relative; padding-top: var(--pg-3); }
  .dialog-foot .btn { flex: 1 1 0; }
}
@keyframes dlg-fade { from { opacity: 0; } }
@keyframes dlg-pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
@keyframes dlg-up { from { transform: translateY(100%); } }
@media (prefers-reduced-motion: reduce) { .dialog, .dialog-backdrop { animation: none !important; } }

/* ---- Page header (<PageHeader>) and messages (<Flash>) --------------------------------------------------------- */
.page-head { margin-bottom: var(--pg-3); }
.page-head .back-link { margin: calc(-1 * var(--pg-1)) 0 var(--pg-1) -4px; }
.page-head-row { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--pg-2); flex-wrap: wrap; }
.page-head-text { min-width: 0; flex: 1 1 260px; }
.page-head h1 { margin-bottom: 4px; }
.page-sub { margin: 0; color: var(--pg-slate); }
.page-actions { display: flex; gap: var(--pg-1); flex-wrap: wrap; }
@media (max-width: 700px) {
  .page-actions { width: 100%; }
  .page-actions > .btn-main { flex: 1 1 auto; }
}

.flash {
  display: flex; align-items: flex-start; gap: 10px; margin-bottom: var(--pg-2); padding: 12px var(--pg-2);
  border-radius: var(--pg-radius-control); font-size: var(--pg-small); animation: dlg-pop .2s ease-out;
}
.flash .ic { margin-top: 1px; }
.flash-ok { background: var(--pg-success-tint); color: var(--pg-ink); }
.flash-ok .ic { color: var(--pg-success); }
.flash-bad { background: var(--pg-danger-tint); color: var(--pg-ink); }
.flash-bad .ic { color: var(--pg-buoy); }

/* ---- Section headings inside a page (an h2 with an optional link on the right) ---------------------------------- */
.section-head { display: flex; align-items: center; justify-content: space-between; gap: var(--pg-2); margin: var(--pg-4) 0 var(--pg-2); }
.section-head:first-child { margin-top: 0; }
.section-head h2 { margin: 0; font-size: var(--pg-h3); }

/* ---- Toasts -------------------------------------------------------------- */
.toasts { position: fixed; left: 0; right: 0; bottom: calc(var(--pg-2) + env(safe-area-inset-bottom)); display: grid; justify-items: center; gap: var(--pg-1); z-index: 60; pointer-events: none; padding: 0 var(--pg-gutter); }
.toast { pointer-events: auto; background: var(--pg-ink); color: var(--pg-white); border-radius: var(--pg-radius-control); padding: 12px var(--pg-2); font-size: var(--pg-small); font-weight: 600; box-shadow: var(--pg-shadow-2); max-width: 420px; }
.toast.bad { background: var(--pg-buoy); }

/* ---- Empty state --------------------------------------------------------- */
.empty { text-align: center; padding: var(--pg-5) var(--pg-2); color: var(--pg-slate); }
.empty h3 { color: var(--pg-ink); }

/* ---- Icons --------------------------------------------------------------- */
.ic { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: var(--pg-icon-stroke); stroke-linecap: round; stroke-linejoin: round; }

/* ---- Small utility set (Identity pages use these) ----------------------- */
.mb-0 { margin-bottom: 0 !important; } .mb-2 { margin-bottom: var(--pg-1); } .mb-3 { margin-bottom: var(--pg-2); } .mb-4 { margin-bottom: var(--pg-3); }
.mt-2 { margin-top: var(--pg-1); } .mt-3 { margin-top: var(--pg-2); } .mt-4 { margin-top: var(--pg-3); } .ms-1 { margin-left: 4px; }
.py-2 { padding-top: var(--pg-1); padding-bottom: var(--pg-1); }
.text-center { text-align: center; }
.fw-semibold, .font-weight-bold { font-weight: 700; }
.row { display: flex; flex-wrap: wrap; gap: var(--pg-3); }
.row > [class^="col"] { flex: 1 1 280px; min-width: 0; }
.list-plain { list-style: none; margin: 0; padding: 0; }

/* ---- Blazor error + reconnect ------------------------------------------- */
#blazor-error-ui {
  display: none; position: fixed; left: var(--pg-2); right: var(--pg-2); bottom: var(--pg-2); z-index: 70;
  background: var(--pg-ink); color: var(--pg-white); padding: 12px var(--pg-2); border-radius: var(--pg-radius-control);
  box-shadow: var(--pg-shadow-2); font-size: var(--pg-small);
}
#blazor-error-ui a { color: var(--pg-white); font-weight: 700; margin-left: var(--pg-1); }
#blazor-error-ui .dismiss { float: right; cursor: pointer; }

.reconnect-overlay { display: none; }
.reconnect-overlay.components-reconnect-show,
.reconnect-overlay.components-reconnect-failed,
.reconnect-overlay.components-reconnect-rejected {
  display: grid; place-items: center; position: fixed; inset: 0; z-index: 80; padding: var(--pg-2);
  background: rgba(16, 38, 58, .45);
}
html.pg-reloading .reconnect-overlay { display: none !important; }
.reconnect-card { background: var(--pg-white); border-radius: var(--pg-radius-card); padding: var(--pg-4); max-width: 420px; text-align: center; box-shadow: var(--pg-shadow-2); }
.reconnect-card h2 { font-size: var(--pg-h3); }
.reconnect-card p { color: var(--pg-slate); }
.reconnect-failed-text { display: none; }
.components-reconnect-failed .reconnect-failed-text, .components-reconnect-rejected .reconnect-failed-text { display: block; }
.components-reconnect-failed .reconnect-reconnecting, .components-reconnect-rejected .reconnect-reconnecting { display: none; }
.reconnect-actions { display: flex; gap: var(--pg-1); justify-content: center; flex-wrap: wrap; }

/* ---- Phone ---------------------------------------------------------------- */
@media (max-width: 700px) {
  :root { --pg-h1: 28px; --pg-h2: 22px; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat { padding: 12px var(--pg-2); }
  .stat .value { font-size: 24px; }
  .card { padding: var(--pg-2); }
  .table-wrap table.table thead { display: none; }
  .table-wrap table.table, .table-wrap table.table tbody, .table-wrap table.table tr, .table-wrap table.table td { display: block; width: 100%; }
  .table-wrap table.table tr { padding: 12px var(--pg-2); border-bottom: 1px solid var(--pg-line); }
  .table-wrap table.table td { border: 0; padding: 2px 0; }
  .table-wrap table.table td[data-label]::before { content: attr(data-label) ": "; color: var(--pg-slate); font-size: var(--pg-tiny); }
  /* The first cell is the row's title (a name, a date); the rest are small details under it. */
  .table-wrap table.table td:first-child { font-size: var(--pg-body-size); font-weight: 700; padding-bottom: 4px; }
  .table-wrap table.table td:first-child::before { content: none; }
  .table-wrap table.table td:not(:first-child) { font-size: var(--pg-small); }
}

/* ---- Avatar / coming soon ----------------------------------------------- */
.pg-avatar { display: inline-grid; place-items: center; border-radius: 50%; font-weight: 700; flex: none; }
.soon-hero { text-align: center; padding: var(--pg-6) var(--pg-2); background: var(--pg-white); border: 1px dashed var(--pg-line); border-radius: var(--pg-radius-card); }
.soon-hero-ic { display: inline-grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--pg-brand-tint); color: var(--pg-brand); margin-bottom: var(--pg-2); }
.soon-pill { display: inline-block; margin-bottom: var(--pg-1); padding: 2px 10px; border-radius: var(--pg-radius-pill); background: var(--pg-sand); font-size: var(--pg-tiny); font-weight: 700; }
.soon-hero-title { font-size: var(--pg-h3); font-weight: 800; letter-spacing: var(--pg-heading-tracking); margin-bottom: var(--pg-1); }
.soon-hero-body { color: var(--pg-slate); max-width: 46ch; margin: 0 auto; }

/* ---- Powered by (client portals) ---------------------------------------- */
.powered-by { text-align: center; font-size: var(--pg-tiny); color: var(--pg-slate); margin: 0; }
.powered-by .pg-logo { font-size: var(--pg-tiny); color: var(--pg-slate); }

.confirm-armed { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* ---- Legacy Identity markup (Certra's account pages not yet rewritten) --------------------------------------------
   Inline SVGs there carry no size of their own; without this they fill the card. Pages being rewritten use .field. */
.auth-head { margin-bottom: var(--pg-3); }
.auth-head .kicker { display: none; }
.auth-head p { color: var(--pg-slate); }
.auth-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--pg-2); }
.auth-field label { font-weight: 600; font-size: var(--pg-small); }
.auth-input { position: relative; }
.auth-input .lead-ic { display: none; }
.auth-reveal { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: none; border: 0; padding: 8px; color: var(--pg-slate); cursor: pointer; }
.auth-reveal svg, .ic-on, .ic-off { width: 20px; height: 20px; }
.auth-submit { width: 100%; min-height: 52px; }
.auth-submit svg { width: 18px; height: 18px; }
.auth-row { display: flex; align-items: center; justify-content: space-between; gap: var(--pg-2); margin-bottom: var(--pg-2); flex-wrap: wrap; }
.auth-check { display: flex; align-items: center; gap: 8px; }
.auth-alt, .auth-alt-sub { text-align: center; font-size: var(--pg-small); margin-top: var(--pg-2); }
.auth-sso, .auth-soon, .auth-divider { display: none; }
main svg:not([width]):not(.ic) { max-width: 24px; max-height: 24px; }

/* ---- Walk cards, chips, lists (client and walker apps) ------------------------------------------------------- */
.walk-card {
  display: flex; align-items: center; gap: var(--pg-2); padding: var(--pg-2);
  background: var(--pg-white); border: 1px solid var(--pg-line); border-radius: var(--pg-radius-card);
  color: var(--pg-ink); text-decoration: none; min-height: var(--pg-tap);
}
.walk-card + .walk-card { margin-top: var(--pg-1); }
.walk-card:hover { border-color: var(--pg-brand-line); color: var(--pg-ink); }
.walk-when { display: flex; flex-direction: column; min-width: 92px; }
.walk-day { font-size: var(--pg-tiny); color: var(--pg-slate); font-weight: 600; }
.walk-time { font-size: 20px; font-weight: 800; letter-spacing: var(--pg-heading-tracking); }
.walk-what { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.walk-what strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty-small { padding: var(--pg-2); }

.chips { display: flex; gap: var(--pg-1); overflow-x: auto; padding-bottom: 4px; margin-bottom: var(--pg-2); scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 64px; min-height: 56px; padding: 6px 10px; border: 1.5px solid var(--pg-line); border-radius: var(--pg-radius-control);
  background: var(--pg-white); color: var(--pg-ink); text-decoration: none; font-weight: 600; font-size: var(--pg-small);
}
.chip small { font-weight: 500; color: var(--pg-slate); font-size: var(--pg-tiny); }
.chip.active { border-color: var(--pg-brand); background: var(--pg-brand-tint); color: var(--pg-brand-strong); }
.slot-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--pg-1); }
.slot-grid .chip { min-width: 0; }
.choice {
  display: flex; align-items: center; gap: var(--pg-2); padding: var(--pg-2); margin-bottom: var(--pg-1);
  background: var(--pg-white); border: 1.5px solid var(--pg-line); border-radius: var(--pg-radius-card);
  color: var(--pg-ink); text-decoration: none; cursor: pointer;
}
.choice:hover { border-color: var(--pg-brand); color: var(--pg-ink); }
.choice .price { margin-left: auto; font-weight: 800; }
.photo-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--pg-1); }
.photo-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--pg-radius-control); }
.detail-list { display: grid; grid-template-columns: auto 1fr; gap: 6px var(--pg-2); margin: 0; }
.detail-list dt { color: var(--pg-slate); font-size: var(--pg-small); }
.detail-list dd { margin: 0; }
.secret { font-size: 24px; font-weight: 800; letter-spacing: 0.1em; font-variant-numeric: tabular-nums; }
.step { font-size: var(--pg-tiny); font-weight: 700; color: var(--pg-slate); margin-bottom: 4px; }
.back-link { display: inline-flex; align-items: center; gap: 4px; min-height: var(--pg-tap); font-weight: 600; text-decoration: none; }

/* ---- Segmented control (week nav) and filter chips ------------------------------------------------------------ */
.seg { display: inline-flex; border: 1.5px solid var(--pg-line); border-radius: var(--pg-radius-control); background: var(--pg-white); overflow: hidden; }
.seg-btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 40px; min-width: 44px; padding: 0 12px;
  color: var(--pg-ink); font-weight: 600; font-size: var(--pg-small); text-decoration: none;
}
.seg-btn + .seg-btn { border-left: 1px solid var(--pg-line); }
.seg-btn:hover { background: var(--pg-mist); color: var(--pg-ink); }
.seg-btn.active { background: var(--pg-brand-tint); color: var(--pg-brand-strong); }
.chip-pill {
  flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px 0 10px;
  font: inherit; font-size: var(--pg-small); font-weight: 600; color: var(--pg-ink); cursor: pointer;
  background: var(--pg-white); border: 1.5px solid var(--pg-line); border-radius: var(--pg-radius-pill);
}
.chip-pill > span:last-child { min-width: 22px; padding: 1px 6px; border-radius: var(--pg-radius-pill); background: var(--pg-mist); color: var(--pg-slate); font-size: var(--pg-tiny); text-align: center; }
.chip-pill.active { border-color: var(--pg-brand); background: var(--pg-brand-tint); color: var(--pg-brand-strong); }
.chip-pill.warn > span:last-child { background: var(--pg-buoy); color: var(--pg-on-buoy); }

/* ---- Owner calendar: a week of days; a day-by-day list where there isn't room for seven columns --------------- */
.cal-bar { display: flex; align-items: center; justify-content: space-between; gap: var(--pg-2); flex-wrap: wrap; margin-bottom: var(--pg-2); }
.cal-filter { margin: 0; flex: 1 1 auto; min-width: 0; }
.cal-summary { margin: 0; font-size: var(--pg-small); color: var(--pg-slate); white-space: nowrap; }

.cal-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: var(--pg-1); align-items: start; }
.cal-day { min-height: 220px; padding: var(--pg-1); background: var(--pg-white); border: 1px solid var(--pg-line); border-radius: var(--pg-radius-card); }
.cal-day.empty { background: transparent; border-style: dashed; }
.cal-day.past { opacity: .72; }
.cal-day-head { display: flex; align-items: baseline; gap: 6px; padding: 4px 4px var(--pg-1); }
.cal-dow { font-size: var(--pg-tiny); font-weight: 700; color: var(--pg-slate); text-transform: uppercase; letter-spacing: .04em; }
.cal-date {
  display: inline-grid; place-items: center; min-width: 32px; height: 32px; border-radius: 50%;
  font-size: 18px; font-weight: 800; letter-spacing: var(--pg-heading-tracking);
}
.cal-day.today .cal-date { background: var(--pg-brand); color: var(--pg-on-brand); }
.cal-month { display: none; font-size: var(--pg-small); color: var(--pg-slate); }
.cal-count { margin-left: auto; font-size: var(--pg-tiny); font-weight: 700; color: var(--pg-slate); }
.cal-free { margin: 4px; font-size: var(--pg-tiny); color: var(--pg-slate); }

/* A walk: compact and tappable (details, walker and cancel open in a <Modal>), so a 15-walk day stays readable. */
.cal-walk {
  --state: var(--pg-brand);
  display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "time who" "body body";
  gap: 2px 6px; width: 100%; margin: 0 0 4px; padding: 6px 8px 6px 10px; text-align: left;
  font: inherit; font-size: var(--pg-tiny); color: var(--pg-ink); cursor: pointer;
  background: color-mix(in srgb, var(--state) 7%, var(--pg-white)); border: 0; border-radius: 10px;
  box-shadow: inset 3px 0 0 var(--state); transition: background-color .15s ease, transform .1s ease;
}
.cal-walk:hover { background: color-mix(in srgb, var(--state) 14%, var(--pg-white)); }
.cal-walk:active { transform: scale(.98); }
.cal-walk.is-unassigned { --state: var(--pg-buoy); }
.cal-walk.is-live { --state: var(--pg-success); }
.cal-walk.is-done { --state: var(--pg-slate); }
.cal-walk.is-done .cal-walk-client, .cal-walk.is-done .cal-walk-time strong { color: var(--pg-slate); }
.cal-walk.is-cancelled { --state: var(--pg-line); opacity: .6; }
.cal-walk.is-cancelled .cal-walk-client { text-decoration: line-through; }
.cal-walk-time { grid-area: time; display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.cal-walk-time strong { font-size: var(--pg-small); font-weight: 800; letter-spacing: var(--pg-heading-tracking); }
.cal-walk-time small { font-size: 11px; color: var(--pg-slate); white-space: nowrap; }
.cal-walk-who { grid-area: who; display: flex; align-items: center; }
.cal-walk-body { grid-area: body; display: flex; flex-direction: column; min-width: 0; }
.cal-walk-client, .cal-walk-meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-walk-client { font-weight: 700; font-size: var(--pg-small); }
.cal-walk-meta { color: var(--pg-slate); }
.cal-need { width: 10px; height: 10px; border-radius: 50%; background: var(--pg-buoy); font-size: 0; }

/* Colour key */
.cal-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0 0 var(--pg-2); font-size: var(--pg-tiny); color: var(--pg-slate); }
.cal-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cal-legend span::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--state, var(--pg-brand)); }
.cal-legend .is-unassigned { --state: var(--pg-buoy); }
.cal-legend .is-live { --state: var(--pg-success); }
.cal-legend .is-done { --state: var(--pg-slate); }
.cal-legend .is-cancelled { --state: var(--pg-line); }

/* Day strip (narrow screens only) */
.cal-days { display: none; }

/* Not enough room for seven columns (laptop with sidebar, tablet, phone): a list of days. */
@media (max-width: 1180px) {
  .cal-days {
    position: sticky; top: calc(56px + env(safe-area-inset-top)); z-index: 5;
    display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px;
    margin: 0 calc(-1 * var(--pg-gutter)) var(--pg-2); padding: 8px var(--pg-gutter);
    background: color-mix(in srgb, var(--pg-mist) 92%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--pg-line);
  }
  .cal-days-item {
    display: flex; flex-direction: column; align-items: center; gap: 0; min-height: var(--pg-tap); padding: 4px 0;
    border-radius: var(--pg-radius-control); color: var(--pg-ink); text-decoration: none; font-size: var(--pg-tiny);
  }
  .cal-days-item span { color: var(--pg-slate); font-weight: 600; }
  .cal-days-item strong { font-size: 16px; font-weight: 800; }
  .cal-days-item small { font-size: 11px; color: var(--pg-slate); }
  .cal-days-item.today { background: var(--pg-brand); color: var(--pg-on-brand); }
  .cal-days-item.today span, .cal-days-item.today small { color: var(--pg-on-brand); }
  .cal-day { scroll-margin-top: 150px; }

  .cal-week { grid-template-columns: minmax(0, 1fr); gap: var(--pg-3); }
  .cal-day { min-height: 0; padding: 0; background: none; border: 0; }
  .cal-day.empty { display: flex; align-items: center; border: 0; }
  .cal-day.empty .cal-free { display: inline; margin: 0 0 0 4px; }
  .cal-day-head { padding: 0 0 var(--pg-1); }
  .cal-day.empty .cal-day-head { padding: 0; }
  .cal-dow { width: 36px; }
  .cal-day:not(.empty) .cal-month { display: inline; }
  .cal-walk {
    grid-template-columns: 64px minmax(0, 1fr) auto; grid-template-areas: "time body who";
    align-items: center; gap: 12px; min-height: 60px; padding: 10px 12px 10px 14px; margin-bottom: 6px;
    background: var(--pg-white); border: 1px solid var(--pg-line); box-shadow: inset 4px 0 0 var(--state); font-size: var(--pg-small);
  }
  .cal-walk-time { flex-direction: column; gap: 0; }
  .cal-walk-time strong { font-size: 16px; }
  .cal-walk-time small { font-size: var(--pg-tiny); }
  .cal-walk-client { font-size: 16px; }
  .cal-need { width: auto; height: auto; padding: 2px 8px; border-radius: var(--pg-radius-pill); background: var(--pg-danger-tint); color: var(--pg-buoy); font-size: var(--pg-tiny); font-weight: 700; white-space: nowrap; }
}

/* ---- Device guides: InstallGuide, InstallSteps, AllowSteps, PushPrompt, the Notifications page ---------------- */
.guide-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: var(--pg-2); }
.guide-icon { width: 48px; height: 48px; border-radius: 12px; flex: none; background: var(--pg-white); box-shadow: 0 0 0 1px var(--pg-line); }
.guide-title { flex: 1; min-width: 0; }
.guide-title h2 { font-size: var(--pg-h3); margin-bottom: 4px; }
.guide-head .dialog-close { margin: -10px -10px 0 0; }
.steps { list-style: none; counter-reset: step; margin: 0; padding: 0; display: grid; gap: 12px; }
.steps li { counter-increment: step; display: grid; grid-template-columns: 28px 1fr; gap: 12px; align-items: start; }
.steps li::before {
  content: counter(step); display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: var(--pg-brand-tint); color: var(--pg-brand-strong); font-weight: 800; font-size: var(--pg-small);
}
.steps .ic { vertical-align: -3px; }
.device-steps + .device-steps:not([hidden]) { margin-top: var(--pg-2); }
.push-panel [data-push-state] > p:first-child { margin-bottom: var(--pg-2); }
.push-on { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.push-on .ic { color: var(--pg-success); }
.push-prompt { display: flex; align-items: center; gap: 12px; color: var(--pg-ink); text-decoration: none; }
.push-prompt:hover { border-color: var(--pg-brand-line); color: var(--pg-ink); }
.push-prompt-ic { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; flex: none; background: var(--pg-brand-tint); color: var(--pg-brand); }
.push-prompt-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.push-prompt > svg:last-child { color: var(--pg-slate); }

/* On a computer the "Turn on" button doesn't need to span the card. */
@media (min-width: 701px) { .push-panel .btn-block { width: auto; } }

/* Laptop with the sidebar: no top bar, so the day strip sticks to the very top. */
@media (min-width: 901px) and (max-width: 1180px) { .cal-days { top: 0; } }

/* ---- Page rhythm: the same space between every top-level block on every page ------------------------------------
   Cards, sections, grids and tables directly in the page are 24px apart (32px on a desktop). Don't add mb-* to
   space top-level blocks; it's done here. Card titles are one size everywhere. */
.app-main > :is(.card, section, .grid-2, .grid-3, .grid-4, .table-wrap, .panel-sand, .cal-week, form) + :is(.card, section, .grid-2, .grid-3, .grid-4, .table-wrap, .panel-sand, form) { margin-top: var(--pg-3); }
.card > h2:first-child, .card > .section-head:first-child h2, .card > .row-between:first-child h2, .panel-sand > h2:first-child { font-size: var(--pg-h3); margin-bottom: var(--pg-1); }
.card > h2:first-child + p.small { margin-top: 0; }
.card :is(.btn-brand, .btn-main):last-child:not(.btn-block) { margin-top: var(--pg-1); }

/* ---- Small layout helpers (instead of inline styles) ----------------------------------------------------------- */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: var(--pg-2); flex-wrap: wrap; margin-bottom: var(--pg-2); }
.search-input { max-width: 360px; }
@media (max-width: 700px) { .search-input { max-width: none; } }
.inline-row { display: flex; align-items: center; gap: var(--pg-1); flex-wrap: wrap; }
.list-row { display: flex; align-items: center; justify-content: space-between; gap: var(--pg-2); flex-wrap: wrap; min-height: 56px; padding: 8px 0; border-bottom: 1px solid var(--pg-line); }
.list-row:last-child { border-bottom: 0; }
.card-narrow { max-width: 640px; }
.field-short { max-width: 200px; }
.nowrap { white-space: nowrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.plain-link { color: inherit; text-decoration: none; }
.plain-link:hover { color: var(--pg-brand); }
fieldset.field { border: 0; padding: 0; margin: 0 0 var(--pg-2); min-width: 0; }
summary { cursor: pointer; list-style: none; }
summary::-webkit-details-marker { display: none; }
.colour-input { width: 56px; height: var(--pg-tap); padding: 0; border: 0; background: none; flex: none; }
.icon-preview { width: 72px; height: 72px; border-radius: var(--pg-radius-card); border: 1px solid var(--pg-line); }

/* Week view: columns are narrow, so the length gives way to the walker's initials (it's in the details sheet). */
@media (min-width: 1181px) { .cal-walk-time small { display: none; } }
@media (max-width: 700px) { .cal-legend { display: none; } }
.detail-list + .field { margin-top: var(--pg-3); }
