/* Piritiz app UI — design system for app.piritiz.com
   Layout: dark nav rail | working panel | map.
   Loaded after bootstrap.min.css so pages not yet rebuilt keep working. */

:root {
  --pz-bg: #f3f5f4;
  --pz-surface: #ffffff;
  --pz-surface-2: #eaeeec;
  --pz-line: #d9dfdc;
  --pz-fg: #14201d;
  --pz-muted: #5d6b67;
  --pz-rail: #10231f;
  --pz-rail-fg: #b9c9c4;
  --pz-rail-active: #ffffff;
  --pz-accent: #0b6e5c;
  --pz-accent-hover: #095c4d;
  --pz-accent-soft: #dcefe9;
  --pz-on-accent: #ffffff;
  --pz-ok: #1f8a4c;
  --pz-ok-soft: #dff2e6;
  --pz-warn: #a86400;
  --pz-warn-soft: #fbecd2;
  --pz-crit: #c2362b;
  --pz-crit-soft: #fbe1de;
  --pz-idle: #66757a;
  --pz-idle-soft: #e6eaeb;
  --pz-font-ui: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --pz-font-data: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --pz-r: 10px;
  --pz-rail-w: 88px;
  --pz-panel-w: 380px;
}

/* ---------- base (overrides Bootstrap 3 defaults) ---------- */
html, body.pz { height: 100%; }
body.pz {
  margin: 0;
  background: var(--pz-bg);
  color: var(--pz-fg);
  font-family: var(--pz-font-ui);
  font-size: 14px;
  line-height: 1.45;
  padding: 0;
}
.pz *, .pz *::before, .pz *::after { box-sizing: border-box; }
.pz h1, .pz h2, .pz h3, .pz p { margin: 0; }
.pz a { color: var(--pz-accent); }
.pz a:hover, .pz a:focus { color: var(--pz-accent-hover); }
/* components that are links keep their own colors */
.pz a.pz-btn, .pz a.pz-btn:hover, .pz a.pz-btn:focus { color: var(--pz-fg); }
.pz a.pz-btn-primary, .pz a.pz-btn-primary:hover, .pz a.pz-btn-primary:focus { color: var(--pz-on-accent); }
.pz a.pz-row, .pz a.pz-row:hover, .pz a.pz-row:focus { color: inherit; }
.pz .pz-chips a, .pz .pz-chips a:hover { color: var(--pz-fg); }
.pz .pz-chips a[aria-pressed="true"] { color: var(--pz-surface); }
.pz a.pz-icon-btn { color: var(--pz-muted); }
.pz :focus-visible { outline: 2px solid var(--pz-accent); outline-offset: 2px; }
.pz .mono { font-family: var(--pz-font-data); font-variant-numeric: tabular-nums; }
.pz [hidden] { display: none !important; }

/* ---------- app shell ---------- */
.pz-app {
  display: grid;
  grid-template-columns: var(--pz-rail-w) minmax(0, 1fr);
  height: 100%;
  min-height: 560px;
}
.pz-main { min-width: 0; min-height: 0; overflow: auto; }

.pz-rail {
  background: var(--pz-rail);
  color: var(--pz-rail-fg);
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 8px;
}
.pz-brand {
  color: var(--pz-rail-active);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: .02em;
  text-align: center;
  padding: 6px 0 14px;
  text-decoration: none;
}
.pz a.pz-brand, .pz a.pz-brand:hover, .pz a.pz-brand:focus { color: var(--pz-rail-active); text-decoration: none; }
.pz-brand { display: flex; justify-content: center; }
.pz-brand img { display: block; width: 64px; height: auto; }
.pz-auth-brand img { display: block; width: 122px; height: auto; }
.pz-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.pz-nav a {
  color: inherit;
  border-radius: var(--pz-r);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 4px;
  font-size: 11.5px;
  font-weight: 500;
  text-align: center;
  text-decoration: none;
}
.pz-nav a:hover, .pz-nav a:focus { color: var(--pz-rail-active); text-decoration: none; }
.pz-nav a[aria-current="page"] { background: rgba(255, 255, 255, .1); color: var(--pz-rail-active); }
.pz-nav svg {
  width: 22px; height: 22px;
  fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round;
}
.pz-nav .pz-spacer { flex: 1; }
/* Desktop: the "More" items sit in the rail as usual and the More button is hidden. */
.pz-more { display: contents; }
.pz-more-btn { display: none; }
.pz-nav .pz-user { font-size: 11px; opacity: .8; overflow-wrap: anywhere; padding: 0 2px; text-align: center; }

/* ---------- split view: panel + map ---------- */
.pz-split {
  display: grid;
  grid-template-columns: var(--pz-panel-w) minmax(0, 1fr);
  height: 100%;
}
.pz-panel {
  background: var(--pz-surface);
  border-right: 1px solid var(--pz-line);
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 16px;
  overflow-y: auto;
  min-width: 0;
  min-height: 0;
}
.pz-mapwrap { position: relative; min-width: 0; min-height: 0; background: #e9ece6; }
.pz-map { position: absolute; inset: 0; }
.pz-maphint {
  position: absolute; left: 12px; bottom: 24px;
  background: var(--pz-surface);
  border: 1px solid var(--pz-line);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12.5px;
  color: var(--pz-muted);
  max-width: calc(100% - 24px);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .12);
}

/* Pages not rebuilt yet (Bootstrap markup) get page padding inside the new shell. */
.pz-main > :not(.pz-split) { padding: 24px 20px 40px; }

/* ---------- single-column page (forms, subscriptions) ---------- */
.pz-page { max-width: 1000px; margin: 0 auto; padding: 24px 20px 40px; }
.pz-page-narrow { max-width: 520px; }
.pz-card {
  background: var(--pz-surface);
  border: 1px solid var(--pz-line);
  border-radius: var(--pz-r);
  padding: 20px;
}

/* ---------- type ---------- */
.pz-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pz-head h1 { font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.pz-title { font-size: 19px; font-weight: 700; overflow-wrap: anywhere; }
.pz-sub { color: var(--pz-muted); font-size: 13px; }
.pz-label { font-size: 11.5px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--pz-muted); }
.pz-note { font-size: 12.5px; color: var(--pz-muted); background: var(--pz-surface-2); border-radius: var(--pz-r); padding: 9px 11px; }
.pz-section { display: flex; flex-direction: column; gap: 10px; padding-top: 14px; border-top: 1px solid var(--pz-line); }

/* ---------- buttons & links ---------- */
.pz-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--pz-surface);
  color: var(--pz-fg);
  border: 1px solid var(--pz-line);
  border-radius: var(--pz-r);
  padding: 8px 14px;
  font: inherit;
  font-weight: 600;
  line-height: 1.3;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.pz-btn:hover, .pz-btn:focus { border-color: var(--pz-fg); color: var(--pz-fg); text-decoration: none; }
.pz-btn:disabled { opacity: .5; cursor: not-allowed; }
.pz-btn-primary { background: var(--pz-accent); border-color: var(--pz-accent); color: var(--pz-on-accent); }
.pz-btn-primary:hover, .pz-btn-primary:focus { background: var(--pz-accent-hover); border-color: var(--pz-accent-hover); color: var(--pz-on-accent); }
.pz-btn-danger { color: var(--pz-crit); }
.pz-btn-danger:hover, .pz-btn-danger:focus { border-color: var(--pz-crit); color: var(--pz-crit); }
.pz-btn-sm { padding: 5px 10px; font-size: 13px; }
.pz-btn-wide { width: 100%; }
.pz-link {
  background: none; border: 0; padding: 0;
  color: var(--pz-accent); font: inherit; font-weight: 600;
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.pz-link:hover, .pz-link:focus { text-decoration: underline; color: var(--pz-accent-hover); }
.pz-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- summary tiles ---------- */
.pz-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pz-summary div { background: var(--pz-surface-2); border-radius: var(--pz-r); padding: 8px 10px; }
.pz-summary b { display: block; font-size: 20px; font-weight: 700; line-height: 1.1; }
.pz-summary span { font-size: 12px; color: var(--pz-muted); }

/* ---------- banners & flash messages ---------- */
.pz-banner {
  border-radius: var(--pz-r);
  padding: 10px 12px;
  display: flex; gap: 10px; align-items: center; justify-content: space-between;
  font-size: 13px;
  background: var(--pz-surface-2);
}
.pz-banner-crit { background: var(--pz-crit-soft); }
.pz-banner-crit b { color: var(--pz-crit); }
.pz-banner-warn { background: var(--pz-warn-soft); }
.pz-banner-warn b { color: var(--pz-warn); }
.pz .alert { border: 0; border-radius: var(--pz-r); padding: 10px 36px 10px 12px; margin: 0; font-size: 13px; }
.pz .alert { position: relative; }
.pz .alert ul { margin: 0; padding-left: 0; list-style: none; }
.pz .alert .close {
  position: absolute; top: 6px; right: 8px; float: none;
  border: 0; background: none; padding: 2px 6px; margin: 0;
  font-size: 18px; line-height: 1; color: inherit; opacity: .6; cursor: pointer; text-shadow: none;
}
.pz .alert .close:hover { opacity: 1; }
.pz .alert-danger { background: var(--pz-crit-soft); color: var(--pz-crit); }
.pz .alert-warning { background: var(--pz-warn-soft); color: var(--pz-warn); }
.pz .alert-success { background: var(--pz-ok-soft); color: var(--pz-ok); }
.pz .alert-info { background: var(--pz-accent-soft); color: var(--pz-accent); }

/* ---------- forms ---------- */
.pz-field { display: flex; flex-direction: column; gap: 5px; }
.pz-field > label, .pz-field .pz-lab { font-size: 13px; font-weight: 600; margin: 0; }
.pz-input, .pz-select, .pz .form-control {
  background: var(--pz-surface);
  border: 1px solid var(--pz-line);
  border-radius: var(--pz-r);
  padding: 8px 10px;
  width: 100%;
  height: auto;
  font: inherit;
  color: var(--pz-fg);
  box-shadow: none;
}
.pz-input:focus, .pz-select:focus, .pz .form-control:focus { border-color: var(--pz-accent); outline: none; box-shadow: none; }
.pz-search { display: grid; grid-template-columns: 1fr 1fr auto; gap: 6px; }
.pz-search .pz-input { background: var(--pz-surface-2); border-color: transparent; }
.pz-search .pz-input:focus { background: var(--pz-surface); border-color: var(--pz-accent); }
.pz-range { width: 100%; accent-color: var(--pz-accent); }
.pz-checks { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.pz-checks label { font-weight: 400; font-size: 13.5px; display: flex; gap: 6px; align-items: center; margin: 0; }
.pz-checks input { accent-color: var(--pz-accent); margin: 0; }

/* ---------- chips ---------- */
.pz-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pz-chips a, .pz-chips button {
  background: var(--pz-surface);
  border: 1px solid var(--pz-line);
  border-radius: 20px;
  padding: 4px 11px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--pz-fg);
  cursor: pointer;
  text-decoration: none;
  line-height: 1.4;
}
.pz-chips a:hover, .pz-chips button:hover { border-color: var(--pz-fg); color: var(--pz-fg); text-decoration: none; }
.pz-chips [aria-pressed="true"], .pz-chips [aria-current="true"] { background: var(--pz-fg); color: var(--pz-surface); border-color: var(--pz-fg); }
.pz-chips [aria-pressed="true"]:hover { color: var(--pz-surface); }

/* ---------- list rows ---------- */
.pz-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.pz-list > li + li { border-top: 1px solid var(--pz-line); }
.pz-row {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 11px 4px;
  border-radius: 6px;
  color: inherit;
  text-decoration: none;
  width: 100%;
  background: none;
  border: 0;
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.pz-row:hover, .pz-row:focus { background: var(--pz-surface-2); color: inherit; text-decoration: none; }
.pz-row.is-selected { background: var(--pz-accent-soft); }
.pz-row .pz-name { font-weight: 600; overflow-wrap: anywhere; }
.pz-row .pz-meta { font-size: 12.5px; color: var(--pz-muted); overflow-wrap: anywhere; }
.pz-row .pz-right { text-align: right; font-size: 12px; color: var(--pz-muted); white-space: nowrap; }
.pz-empty { color: var(--pz-muted); padding: 14px 4px; }
.pz-tracker { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 2px; }
.pz-rowtools { display: flex; flex-direction: column; gap: 2px; }
.pz-icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  border-radius: 6px; border: 0; background: none;
  color: var(--pz-muted); cursor: pointer;
}
.pz-icon-btn:hover, .pz-icon-btn:focus { background: var(--pz-surface); color: var(--pz-fg); }
.pz-icon-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* status dots & pills */
.pz-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.pz-s-ok { background: var(--pz-ok); }
.pz-s-idle { background: var(--pz-idle); }
.pz-s-crit { background: var(--pz-crit); }
.pz-s-warn { background: var(--pz-warn); }
.pz-pill { display: inline-block; border-radius: 20px; padding: 1px 9px; font-size: 12px; font-weight: 600; }
.pz-p-ok { background: var(--pz-ok-soft); color: var(--pz-ok); }
.pz-p-idle { background: var(--pz-idle-soft); color: var(--pz-idle); }
.pz-p-crit { background: var(--pz-crit-soft); color: var(--pz-crit); }
.pz-p-warn { background: var(--pz-warn-soft); color: var(--pz-warn); }

/* battery glyph: set --w to the charge percentage */
.pz-batt { display: inline-flex; align-items: center; gap: 5px; }
.pz-batt i { display: inline-block; width: 22px; height: 10px; border: 1.5px solid currentColor; border-radius: 3px; position: relative; }
.pz-batt i::after { content: ""; position: absolute; top: 1px; bottom: 1px; left: 1px; width: var(--w, 0%); max-width: calc(100% - 2px); background: currentColor; border-radius: 1px; }
.pz-batt.is-low { color: var(--pz-crit); }

/* key / value */
.pz-kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 9px 16px; margin: 0; }
.pz-kv dt { color: var(--pz-muted); font-size: 13px; font-weight: 400; }
.pz-kv dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.pz-coords-line { display: flex; gap: 8px; align-items: baseline; margin-top: 2px; font-size: 12px; font-weight: 400; color: var(--pz-muted); }
.pz-coords-line .pz-link { font-size: 12px; }

/* history: update list */
.pz-stops { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; max-height: 260px; overflow-y: auto; }
.pz-stops button {
  width: 100%; background: none; border: 0; border-radius: 6px; text-align: left;
  display: grid; grid-template-columns: 74px minmax(0, 1fr); gap: 8px;
  padding: 7px 6px; font: inherit; cursor: pointer;
}
.pz-stops button:hover { background: var(--pz-surface-2); }
.pz-stops button[aria-current="true"] { background: var(--pz-accent-soft); }
.pz-stops .pz-t { color: var(--pz-muted); font-size: 12.5px; }

/* geofence zone row swatch */
.pz-swatch { width: 10px; height: 10px; border-radius: 3px; background: var(--pz-accent); }
.pz-swatch.is-legacy { background: var(--pz-idle); }

/* toast */
.pz-toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--pz-fg); color: var(--pz-surface);
  border-radius: var(--pz-r); padding: 9px 14px; font-size: 13px; font-weight: 500;
  z-index: 1000; box-shadow: 0 4px 14px rgba(0, 0, 0, .2);
}

/* pagination partial (Bootstrap markup) */
.pz .pagination { margin: 4px 0 0; display: flex; flex-wrap: wrap; gap: 4px; }
.pz .pagination > li > a, .pz .pagination > li > span {
  border-radius: 8px !important; border: 1px solid var(--pz-line); color: var(--pz-fg);
  padding: 4px 10px; float: none; margin: 0;
}
.pz .pagination > .active > a, .pz .pagination > .active > span { background: var(--pz-fg); border-color: var(--pz-fg); color: var(--pz-surface); }

/* Google Maps info window */
.pz-iw { font-family: var(--pz-font-ui); font-size: 13px; line-height: 1.45; color: var(--pz-fg); min-width: 160px; }
.pz-iw b { display: block; font-size: 14px; }
.pz-iw .pz-sub { margin: 2px 0 6px; }

/* ---------- generic stacks, cards, lists ---------- */
.pz-stack { display: flex; flex-direction: column; gap: 14px; }
.pz form.pz-stack { margin: 0; }
.pz-card form { display: flex; flex-direction: column; gap: 14px; margin: 0; }
.pz-card form .pz-field > .pz-btn:not(.pz-btn-wide) { align-self: flex-start; }
.pz fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.pz legend { border: 0; margin: 0 0 5px; padding: 0; width: auto; font-size: 13px; font-weight: 600; color: var(--pz-fg); }
.pz-center { align-items: center; text-align: center; }
.pz-card-list { padding: 4px 16px; }
.pz-card-list > li.pz-empty { padding: 14px 0; }
.pz-planrow {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px; align-items: center; padding: 12px 0;
}
.pz-planrow .pz-name { font-weight: 600; overflow-wrap: anywhere; }
.pz-planrow .pz-meta { font-size: 12.5px; color: var(--pz-muted); }
.pz-planrow-act { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.pz-planrow-act:empty { display: none; }
.pz-inline-form { margin: 0; display: inline-flex; }
.pz-check {
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--pz-ok-soft); color: var(--pz-ok);
  display: flex; align-items: center; justify-content: center;
}
.pz-check svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.pz-debug { margin-top: 16px; font-size: 12.5px; }
.pz-debug summary { cursor: pointer; font-weight: 600; }
.pz-debug pre { white-space: pre-wrap; font-size: 11.5px; max-height: 320px; overflow: auto; }

/* ---------- add tracker / checkout ---------- */
.pz-connect { display: grid; grid-template-columns: minmax(0, 480px) minmax(0, 1fr); gap: 28px; align-items: start; }
.pz-product { margin: 0; border-radius: 14px; overflow: hidden; background: var(--pz-surface-2); }
.pz-product img { display: block; width: 100%; height: auto; }
.pz-tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--pz-surface-2); border-radius: var(--pz-r); padding: 4px; gap: 4px; }
.pz-tabs a { text-align: center; padding: 7px 8px; border-radius: 7px; font-weight: 600; font-size: 13.5px; text-decoration: none; }
.pz .pz-tabs a, .pz .pz-tabs a:hover { color: var(--pz-muted); text-decoration: none; }
.pz .pz-tabs a[aria-current="page"] { background: var(--pz-surface); color: var(--pz-fg); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.pz-plans { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pz-plan {
  position: relative; display: flex; flex-direction: column; gap: 1px;
  border: 1px solid var(--pz-line); border-radius: var(--pz-r);
  padding: 10px 12px; margin: 0; cursor: pointer; font-weight: 400;
}
.pz-plan:hover { border-color: var(--pz-fg); }
.pz-plan input { position: absolute; opacity: 0; pointer-events: none; }
.pz-plan.is-checked, .pz-plan:has(input:checked) { border-color: var(--pz-accent); box-shadow: 0 0 0 1px var(--pz-accent) inset; background: var(--pz-accent-soft); }
.pz-plan:has(input:focus-visible) { outline: 2px solid var(--pz-accent); outline-offset: 2px; }
.pz-plan-price { font-size: 18px; font-weight: 700; }
.pz-plan-name { font-weight: 600; font-size: 13.5px; }
.pz-plan-note { font-size: 12px; color: var(--pz-muted); }
.pz-field > .pz-link { align-self: flex-start; }
.pz-serials { display: flex; flex-direction: column; gap: 10px; }
.pz-serial { display: flex; flex-direction: column; gap: 5px; }
.pz-serial-input { display: flex; gap: 6px; align-items: center; }
.pz-serial-input .pz-input { letter-spacing: .06em; }
.pz-serials:not(.is-multi) .pz-remove-serial { display: none; }
.pz-serial-msg { font-size: 12.5px; min-height: 0; }
.is-ok > .pz-serial-msg, .is-ok .pz-serial-msg { color: var(--pz-ok); }
.is-bad > .pz-serial-msg, .is-bad .pz-serial-msg { color: var(--pz-crit); }
.is-ok .pz-input { border-color: var(--pz-ok); }
.is-bad .pz-input { border-color: var(--pz-crit); }
.pz-totals { display: flex; flex-direction: column; gap: 4px; border-top: 1px solid var(--pz-line); padding-top: 12px; }
.pz-totals .pz-total { border-top: 0; padding-top: 0; }
.pz-total-line { display: flex; justify-content: space-between; color: var(--pz-muted); font-size: 13.5px; }
.pz-discount { color: var(--pz-ok); }
.pz-total {
  display: flex; justify-content: space-between; align-items: baseline;
  border-top: 1px solid var(--pz-line); padding-top: 12px; color: var(--pz-muted);
}
.pz-total b { font-size: 24px; color: var(--pz-fg); }

/* ---------- billing ---------- */
.pz-invoice { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 16px; align-items: center; padding: 12px 0; }
.pz-invoice .pz-name { font-weight: 600; }
.pz-invoice .pz-meta { font-size: 12.5px; color: var(--pz-muted); }
.pz-invoice-amt { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.pz-invoice-amt b { font-size: 15px; }
.pz-invoice-act { display: flex; gap: 6px; justify-content: flex-end; min-width: 120px; }
@media (max-width: 900px) {
  .pz-invoice { grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; }
  .pz-invoice-act { grid-column: 1 / -1; justify-content: flex-start; min-width: 0; }
}

/* ---------- share links (tracker page) ---------- */
.pz-sharelink { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 0; }
.pz-sharelink .pz-name { font-weight: 600; }
.pz-sharelink .pz-meta { font-size: 12px; color: var(--pz-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; max-width: 100%; }
.pz-sharelink-act { display: flex; gap: 6px; }
.pz-share-form { background: var(--pz-surface-2); border-radius: var(--pz-r); padding: 12px; }
.pz-share-form .pz-note { background: var(--pz-surface); }
.pz-choices { display: flex; flex-wrap: wrap; gap: 6px; }
.pz-choices label {
  margin: 0; cursor: pointer; font-weight: 500; font-size: 13px;
  border: 1px solid var(--pz-line); background: var(--pz-surface); border-radius: 20px; padding: 5px 12px;
}
.pz-choices label:hover { border-color: var(--pz-fg); }
.pz-choices input { position: absolute; opacity: 0; pointer-events: none; }
.pz-choices label.is-checked, .pz-choices label:has(input:checked) { background: var(--pz-fg); border-color: var(--pz-fg); color: var(--pz-surface); }
.pz-choices label:has(input:focus-visible) { outline: 2px solid var(--pz-accent); outline-offset: 2px; }

/* ---------- public pages (Main / Application layout) ---------- */
body.pz-public-body { display: flex; flex-direction: column; min-height: 100%; height: auto; }
.pz-topbar {
  background: var(--pz-rail); color: var(--pz-rail-fg);
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 20px; gap: 12px;
}
.pz-topbar .pz-brand { padding: 0; }
.pz-topbar .pz-brand img { width: 84px; }
.pz .pz-topbar nav a { color: var(--pz-rail-fg); font-weight: 600; font-size: 13.5px; text-decoration: none; }
.pz .pz-topbar nav a:hover { color: var(--pz-rail-active); }
.pz-public { flex: 1; display: flex; flex-direction: column; }
.pz-share { position: relative; flex: 1; min-height: calc(100vh - 52px); background: #e9ece6; }
.pz-share-card {
  position: absolute; left: 16px; top: 16px; width: 320px; max-width: calc(100% - 32px);
  background: var(--pz-surface); border: 1px solid var(--pz-line); border-radius: 14px;
  padding: 16px; display: flex; flex-direction: column; gap: 8px;
  box-shadow: 0 6px 20px rgba(16, 35, 31, .14);
}
.pz-stale { color: var(--pz-warn); font-weight: 600; }

/* ---------- sign-in pages (Auth layout) ---------- */
body.pz-auth-body { background: var(--pz-bg); min-height: 100%; }
.pz-auth {
  min-height: 100vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; padding: 32px 16px;
}
.pz-auth-brand { font-weight: 700; font-size: 22px; letter-spacing: .02em; color: var(--pz-fg); text-decoration: none; }
.pz a.pz-auth-brand, .pz a.pz-auth-brand:hover { color: var(--pz-fg); text-decoration: none; }
.pz-auth-card {
  width: 100%; max-width: 400px;
  background: var(--pz-surface);
  border: 1px solid var(--pz-line);
  border-radius: 14px;
  padding: 26px 24px;
  display: flex; flex-direction: column; gap: 14px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 8px 24px rgba(16, 35, 31, .06);
}
.pz-auth-card h1 { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.pz-auth-card form { display: flex; flex-direction: column; gap: 14px; margin: 0; }
.pz-auth-foot { color: var(--pz-muted); font-size: 12.5px; }
.pz-auth-foot a { color: var(--pz-muted); }
.pz-or { display: flex; align-items: center; gap: 10px; color: var(--pz-muted); font-size: 12.5px; }
.pz-or::before, .pz-or::after { content: ""; flex: 1; height: 1px; background: var(--pz-line); }
.pz-sso { display: flex; flex-direction: column; gap: 8px; }
.pz-sso .pz-btn { width: 100%; gap: 10px; }
.pz-sso .pz-btn svg { flex-shrink: 0; }
.pz-btn-apple { background: #000; border-color: #000; color: #fff; }
.pz-btn-apple:hover, .pz-btn-apple:focus { background: #222; border-color: #222; color: #fff; }
.pz-links { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; font-size: 13.5px; }
.pz-errors { list-style: none; margin: 2px 0 0; padding: 0; color: var(--pz-crit); font-size: 12.5px; }
.pz-msg { font-size: 13px; color: var(--pz-crit); background: var(--pz-crit-soft); border-radius: var(--pz-r); padding: 9px 11px; }
.pz-msg:empty { display: none; }
.g-recaptcha { transform-origin: 0 0; }
@media (max-width: 360px) { .g-recaptcha { transform: scale(.88); } }

/* ---------- phones & small tablets ---------- */
@media (max-width: 900px) {
  html, body.pz { height: auto; }
  .pz-app { grid-template-columns: minmax(0, 1fr); height: auto; }
  .pz-main { overflow: visible; }
  /* Phones: the rail becomes a bottom tab bar (Trackers, Add tracker, Plans, Billing, More). */
  .pz-app { padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)); }
  .pz-rail {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    flex-direction: row; align-items: stretch;
    padding: 4px max(6px, env(safe-area-inset-right, 0px)) calc(4px + env(safe-area-inset-bottom, 0px)) max(6px, env(safe-area-inset-left, 0px));
    box-shadow: 0 -2px 12px rgba(0, 0, 0, .18);
  }
  .pz-rail > .pz-brand { display: none; }
  .pz-nav { flex-direction: row; flex: 1; gap: 2px; }
  .pz-nav > a, .pz-more-btn { flex: 1 1 0; min-width: 0; padding: 6px 2px; font-size: 11px; }
  .pz-nav .pz-spacer { display: none; }
  .pz-more-btn {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    background: none; border: 0; border-radius: var(--pz-r); color: inherit; font: inherit; font-size: 11px; font-weight: 500; cursor: pointer;
  }
  .pz-more-btn[aria-expanded="true"] { background: rgba(255, 255, 255, .1); color: var(--pz-rail-active); }
  .pz-more {
    display: none;
    position: fixed; right: max(8px, env(safe-area-inset-right, 0px)); bottom: calc(68px + env(safe-area-inset-bottom, 0px));
    min-width: 200px; flex-direction: column; gap: 2px; padding: 6px;
    background: var(--pz-rail); border-radius: 12px; box-shadow: 0 8px 24px rgba(0, 0, 0, .3);
  }
  .pz-more.is-open { display: flex; }
  .pz-more a { flex-direction: row; justify-content: flex-start; gap: 10px; font-size: 14px; padding: 10px 12px; }
  .pz-more .pz-user { display: block; text-align: left; padding: 6px 12px 2px; font-size: 12px; }
  .pz-toast { bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }
  .pz-split { grid-template-columns: minmax(0, 1fr); height: auto; }
  .pz-mapwrap { order: 1; height: 340px; }
  .pz-panel { order: 2; border-right: 0; overflow: visible; }
  .pz-search { grid-template-columns: 1fr 1fr; }
  .pz-search .pz-btn { grid-column: 1 / -1; }
  .pz-connect { grid-template-columns: minmax(0, 1fr); }
  .pz-product { order: -1; max-height: 180px; }
  .pz-product img { max-height: 180px; object-fit: contain; margin: 0 auto; width: auto; }
  .pz-planrow { grid-template-columns: minmax(0, 1fr) auto; }
  .pz-planrow-act { grid-column: 1 / -1; }
  .pz-share { min-height: 70vh; }
  .pz-share-card { left: 12px; right: 12px; top: auto; bottom: 12px; width: auto; }
}

/* ---------- touch screens: phones, tablets, and narrow windows ---------- */
@media (pointer: coarse), (max-width: 900px) {
  /* 16px text in fields stops iPhone Safari from zooming in when a field is tapped. */
  .pz-input, .pz-select, .pz .form-control,
  .pz input[type="text"], .pz input[type="email"], .pz input[type="password"], .pz input[type="search"],
  .pz input[type="number"], .pz input[type="date"], .pz input[type="datetime-local"], .pz select, .pz textarea { font-size: 16px; }

  /* Tap targets of about 44px, as Apple and Google recommend. */
  .pz-input, .pz-select, .pz .form-control { min-height: 44px; }
  .pz-btn { min-height: 44px; }
  .pz-btn-sm { min-height: 40px; padding: 8px 12px; }
  .pz-icon-btn { width: 44px; height: 44px; }
  .pz-icon-btn svg { width: 18px; height: 18px; }
  .pz-chips a, .pz-chips button, .pz-choices label { min-height: 40px; display: inline-flex; align-items: center; padding: 6px 14px; }
  .pz-row { padding-block: 14px; }
  .pz-stops button { padding-block: 12px; }
  .pz-tabs a { padding-block: 11px; }
  .pz-plan { padding: 12px 14px; }
  .pz-checks label { min-height: 40px; }
  .pz-checks input { width: 20px; height: 20px; }
  /* Small text links that stand alone get a taller hit area without moving the layout. */
  .pz-banner .pz-link, #pz-copy-coords, .pz-field > .pz-link, .pz-panel > .pz-link:first-child, .pz-stack > .pz-link:first-child {
    display: inline-flex; align-items: center; min-height: 40px;
  }
  #pz-copy-coords { padding-inline: 10px; margin-inline: -10px; }
  .pz-rowtools { gap: 0; }
}

/* ---------- tablets in portrait (700–900px): list and map side by side ---------- */
@media (min-width: 700px) and (max-width: 900px) {
  .pz-split {
    grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
    height: calc(100vh - 64px - env(safe-area-inset-bottom, 0px));
    height: calc(100dvh - 64px - env(safe-area-inset-bottom, 0px));
  }
  .pz-mapwrap { order: 2; height: auto; }
  .pz-panel { order: 1; overflow-y: auto; border-right: 1px solid var(--pz-line); }
  .pz-search { grid-template-columns: 1fr; }
  .pz-search .pz-btn { grid-column: auto; }
}

/* ================= admin panel ================= */
.pz-admin .pz-brand { flex-direction: column; align-items: center; gap: 6px; }
.pz-rail-tag { font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--pz-rail); background: #f5c46b; border-radius: 4px; padding: 1px 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.pz-s-none { background: transparent; border: 1.5px solid var(--pz-line); }
.pz-strong { font-weight: 600; }
.pz-wrap { overflow-wrap: anywhere; }
.pz-num { text-align: right; white-space: nowrap; }

/* stat tiles */
.pz-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.pz-stat { background: var(--pz-surface); border: 1px solid var(--pz-line); border-radius: var(--pz-r); padding: 14px 16px; display: flex; flex-direction: column; gap: 3px; }
.pz .pz-stat, .pz a.pz-stat { color: var(--pz-fg); }
.pz-stat b { font-size: 26px; line-height: 1.15; font-weight: 600; color: var(--pz-fg); }
.pz a.pz-stat:hover, .pz a.pz-stat:focus { border-color: var(--pz-fg); color: var(--pz-fg); text-decoration: none; }
.pz-stat.is-warn { border-color: var(--pz-warn); background: var(--pz-warn-soft); }
.pz-stat.is-warn b { color: var(--pz-warn); }
.pz-stat.is-crit b { color: var(--pz-crit); }
.pz-stat.is-ok b { color: var(--pz-ok); }
.pz-admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; align-items: start; }
.pz-big { font-size: 30px; font-weight: 600; line-height: 1.2; }
.pz-bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.pz-bars li { display: grid; grid-template-columns: 74px minmax(0, 1fr) 92px; gap: 10px; align-items: center; }
.pz-bars li > :last-child { text-align: right; }
.pz-bar { height: 8px; background: var(--pz-surface-2); border-radius: 4px; overflow: hidden; }
.pz-bar i { display: block; height: 100%; background: var(--pz-accent); border-radius: 4px; }
.pz-admin-map { height: 460px; border-radius: var(--pz-r); overflow: hidden; background: var(--pz-surface-2); }
.pz-kv-tight { gap: 6px 16px; font-size: 13px; }

/* searches */
.pz-search.pz-search-1 { grid-template-columns: minmax(0, 1fr) auto; }
.pz-search.pz-search-3 { grid-template-columns: repeat(3, minmax(0, 1fr)) auto; }
.pz-search.pz-search-dates { grid-template-columns: 170px 170px minmax(0, 1fr) auto; align-items: end; }
.pz-search-dates .pz-field { margin: 0; display: flex; flex-direction: column; gap: 3px; font-weight: 400; }

/* tables: rows on wide screens, cards on phones */
.pz-table-card { padding: 0; overflow: hidden; }
.pz-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.pz-table th { text-align: left; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--pz-muted); padding: 10px 12px; border-bottom: 1px solid var(--pz-line); background: var(--pz-surface-2); white-space: nowrap; }
.pz .pz-table th a { color: inherit; }
.pz .pz-table th a:hover { color: var(--pz-fg); }
.pz-table td { padding: 10px 12px; border-bottom: 1px solid var(--pz-line); vertical-align: middle; }
.pz-table tbody tr:last-child td { border-bottom: 0; }
.pz-table tbody tr:hover { background: #f7f9f8; }
.pz-td-actions { text-align: right; white-space: nowrap; }
.pz-td-actions > * { vertical-align: middle; margin-left: 4px; }
.pz-table .pz-empty { text-align: center; padding: 28px 12px; }

/* page links */
.pz-pager { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.pz-pager a, .pz-pager span[aria-current], .pz-pager > span[aria-hidden] { min-width: 36px; height: 36px; padding: 0 8px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; font-weight: 600; }
.pz .pz-pager a { color: var(--pz-fg); border: 1px solid var(--pz-line); background: var(--pz-surface); text-decoration: none; }
.pz .pz-pager a:hover { border-color: var(--pz-fg); }
.pz-pager span[aria-current] { background: var(--pz-fg); color: var(--pz-surface); }
.pz-pager > span[aria-hidden] { color: var(--pz-line); }
.pz-pager .pz-sub { margin-left: 8px; }

@media (max-width: 900px) {
  .pz-search.pz-search-3 { grid-template-columns: 1fr 1fr; }
  .pz-search.pz-search-3 .pz-btn { grid-column: auto; }
  .pz-search.pz-search-dates { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .pz-search-dates .pz-input { min-width: 0; width: 100%; }
  .pz-search-dates .pz-field:nth-child(3), .pz-search.pz-search-dates .pz-btn { grid-column: 1 / -1; }
  .pz-admin-map { height: 360px; }
  .pz-pager a, .pz-pager span[aria-current] { min-width: 44px; height: 44px; }
}
@media (max-width: 700px) {
  .pz-table, .pz-table tbody, .pz-table tr, .pz-table td { display: block; }
  .pz-table thead { display: none; }
  .pz-table tr { padding: 10px 14px 12px; border-bottom: 1px solid var(--pz-line); }
  .pz-table tbody tr:last-child { border-bottom: 0; }
  .pz-table td { padding: 3px 0; border: 0; }
  .pz-table td[data-label] { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
  .pz-table td[data-label]::before { content: attr(data-label); flex: 0 0 96px; margin-right: 6px; color: var(--pz-muted); font-size: 12.5px; font-family: var(--pz-font-ui); }
  .pz-table td.pz-td-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-start; padding-top: 8px; }
  .pz-table td.pz-td-actions > * { margin: 0; }
  .pz-num { text-align: left; }
  .pz-bars li { grid-template-columns: 64px minmax(0, 1fr) 80px; }
}
