/* =========================================================
   PARKLY — Component & document styles
   ========================================================= */

/* ---------- Document shell ---------- */
.app { display: grid; grid-template-columns: 264px 1fr; min-height: 100vh; }

.sidenav {
  position: sticky; top: 0; align-self: start; height: 100vh;
  border-right: 1px solid var(--line);
  background: var(--surface);
  padding: var(--sp-6) var(--sp-5);
  display: flex; flex-direction: column; gap: var(--sp-6);
  overflow-y: auto;
}
.sidenav__brand { display: flex; align-items: center; gap: 10px; }
.sidenav__group-label {
  font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-400); margin: 0 0 var(--sp-2) 6px;
}
.nav { list-style: none; margin: 0 0 var(--sp-5); padding: 0; display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: var(--r-sm);
  color: var(--ink-700); text-decoration: none; font-size: 14px; font-weight: 500;
  transition: background .15s, color .15s;
}
.nav a:hover { background: var(--paper-2); color: var(--ink-900); }
.nav a.is-active { background: var(--brand-50); color: var(--brand-600); font-weight: 600; }
.nav a.is-active .nav__ic { color: var(--brand-600); }
.nav__ic { width: 17px; height: 17px; color: var(--ink-400); flex: none; }

.main { min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px var(--sp-10); gap: var(--sp-4);
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar__title { font-size: 14px; font-weight: 600; color: var(--ink-500); }
.topbar__right { display: flex; align-items: center; gap: var(--sp-3); }

.canvas { padding: var(--sp-12) var(--sp-10) 120px; max-width: 1080px; }

/* ---------- Section rhythm ---------- */
.section { padding-top: var(--sp-16); scroll-margin-top: 80px; }
.section:first-of-type { padding-top: var(--sp-4); }
.section__eyebrow {
  font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
  color: var(--brand-500); margin: 0 0 10px;
}
.section__title { font-size: 30px; font-weight: 600; letter-spacing: -.02em; margin: 0 0 10px; }
.section__lead { font-size: 16px; line-height: 1.6; color: var(--ink-500); max-width: 60ch; margin: 0 0 var(--sp-8); }
.sub { font-size: 13px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-400); margin: var(--sp-10) 0 var(--sp-4); }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--sh-1);
}
.pad { padding: var(--sp-6); }
.grid { display: grid; gap: var(--sp-4); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.row { display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: center; }
.spec { font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-400); }

/* ---------- Logo ---------- */
.logo { display: inline-flex; align-items: center; gap: 10px; }
.logo__mark { flex: none; display: block; }
.logo__word { font-weight: 700; letter-spacing: -.03em; color: var(--ink-900); }
.logo--sm .logo__word { font-size: 19px; }
.logo--lg .logo__word { font-size: 34px; }
.logo-stage {
  display: grid; place-items: center; gap: var(--sp-6); padding: var(--sp-12);
  border-radius: var(--r-lg);
}
.logo-tile {
  display: grid; place-items: center; aspect-ratio: 1; border-radius: var(--r-md);
  border: 1px solid var(--line); background: var(--surface); padding: var(--sp-6);
}
.logo-tile.invert { background: var(--ink-900); border-color: transparent; }
.logo-tile.brand  { background: var(--brand-500); border-color: transparent; }

/* ---------- Color swatches ---------- */
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px,1fr)); gap: var(--sp-3); }
.swatch { border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; background: var(--surface); }
.swatch__chip { height: 64px; }
.swatch__meta { padding: 8px 10px; }
.swatch__name { font-size: 12.5px; font-weight: 600; }
.swatch__hex { font-family: var(--font-mono); font-size: 11px; color: var(--ink-400); text-transform: uppercase; }

/* ---------- Type specimen ---------- */
.type-row { display: flex; align-items: baseline; gap: var(--sp-6); padding: var(--sp-4) 0; border-bottom: 1px dashed var(--line); }
.type-row:last-child { border-bottom: 0; }
.type-row .lbl { width: 130px; flex: none; }
.type-row .lbl b { display: block; font-size: 13px; }
.type-row .lbl span { font-family: var(--font-mono); font-size: 11px; color: var(--ink-400); }
.type-row .demo { color: var(--ink-900); line-height: 1.1; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: inherit; font-weight: 600; font-size: 14px; line-height: 1;
  padding: 11px 16px; border-radius: var(--r-sm); border: 1px solid transparent;
  cursor: pointer; transition: background .15s, border-color .15s, box-shadow .15s, color .15s, transform .05s;
  white-space: nowrap; text-decoration: none;
}
.btn:active { transform: translateY(.5px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn svg { width: 16px; height: 16px; }
.btn--sm { padding: 8px 12px; font-size: 13px; }
.btn--lg { padding: 14px 22px; font-size: 15px; }
.btn--primary { background: var(--brand-500); color: #fff; box-shadow: var(--sh-1); }
.btn--primary:hover { background: var(--brand-600); }
.btn--primary:active { background: var(--brand-700); }
.btn--secondary { background: var(--surface); color: var(--ink-900); border-color: var(--line-2); }
.btn--secondary:hover { background: var(--paper-2); border-color: var(--ink-400); }
.btn--ghost { background: transparent; color: var(--ink-700); }
.btn--ghost:hover { background: var(--paper-2); color: var(--ink-900); }
.btn--ghost-danger { background: transparent; color: var(--danger-ink); border-color: transparent; }
.btn--ghost-danger:hover { background: var(--danger-bg); }
.btn--danger { background: var(--danger); color: #fff; }
.btn--danger:hover { filter: brightness(.94); }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn--icon { padding: 10px; width: 38px; height: 38px; }

/* ---------- Fields ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 13px; font-weight: 600; color: var(--ink-700); display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.field .hint, .field__hint { font-size: 12px; color: var(--ink-500); margin: 0; line-height: 1.45; }
.field__req { color: var(--danger); font-weight: 700; }
.field__err { font-size: 12.5px; color: var(--danger-ink); font-weight: 600; display: none; }
.field.is-invalid .field__err { display: block; }
.field.is-invalid > .input,
.field.is-invalid > .pxsel .pxsel__btn,
.field.is-invalid > .pxdate .pxdate__btn,
.field.is-invalid > .pxrange .pxr-btn,
.field.is-invalid .input,
.field.is-invalid .pxsel__btn,
.field.is-invalid .pxdate__btn,
.field.is-invalid .pxr-btn { border-color: var(--danger); }
.field.is-invalid > .input:focus,
.field.is-invalid .input:focus { box-shadow: 0 0 0 3px var(--danger-bg); }
.input, .select, .textarea {
  font-family: inherit; font-size: 14px; color: var(--ink-900);
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-sm);
  padding: 11px 13px; transition: border-color .15s, box-shadow .15s; width: 100%;
}
/* Prevent iOS auto-zoom on focus: bump inputs to 16px on touch devices */
@media (pointer: coarse) {
  .input, .select, .textarea, .pxsel__btn, .pxdate__btn { font-size: 16px; }
}
.input::placeholder { color: var(--ink-400); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand-400); box-shadow: var(--ring); }
.input--error { border-color: var(--danger); }
.input--error:focus { box-shadow: 0 0 0 3px var(--danger-bg); }
.field .err { font-size: 12px; color: var(--danger-ink); font-weight: 500; }
.input-group { position: relative; display: flex; align-items: center; }
.input-group .lead { position: absolute; left: 12px; color: var(--ink-400); font-size: 14px; pointer-events: none; }
.input-group .input { padding-left: 30px; }
.input-group .tail { position: absolute; right: 13px; color: var(--ink-400); font-size: 13px; font-family: var(--font-mono); }

.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; }
.switch .track { width: 40px; height: 23px; border-radius: 999px; background: var(--line-2); transition: background .18s; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; border-radius: 50%; background: #fff; box-shadow: var(--sh-1); transition: transform .18s; }
.switch input:checked + .track { background: var(--brand-500); }
.switch input:checked + .track::after { transform: translateX(17px); }
.switch span.lbl { font-size: 14px; color: var(--ink-700); }

.segmented { display: inline-flex; background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 3px; gap: 2px; }
.segmented button {
  font-family: inherit; font-size: 13px; font-weight: 600; color: var(--ink-500);
  background: transparent; border: 0; padding: 7px 14px; border-radius: 7px; cursor: pointer; transition: all .15s;
}
.segmented button.is-active { background: var(--surface); color: var(--ink-900); box-shadow: var(--sh-1); }

/* ---------- Branded select (parkly-select.js) ---------- */
.pxsel { position: relative; display: inline-block; }
.pxsel__btn {
  font-family: inherit; font-size: 14px; color: var(--ink-900); font-weight: 500;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-sm);
  padding: 11px 13px; width: 100%; cursor: pointer; display: flex; align-items: center; gap: 10px;
  justify-content: space-between; transition: border-color .15s, box-shadow .15s;
}
.pxsel__btn:hover { border-color: var(--ink-400); }
.pxsel.is-open .pxsel__btn { border-color: var(--brand-400); box-shadow: var(--ring); }
.pxsel__val { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pxsel__chev { width: 16px; height: 16px; color: var(--ink-400); flex: none; transition: transform .2s; }
.pxsel.is-open .pxsel__chev { transform: rotate(180deg); }
.pxsel__menu {
  position: absolute; top: calc(100% + 6px); left: 0; min-width: 100%; z-index: 80;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: var(--sh-pop); padding: 5px; max-height: 280px; overflow-y: auto;
  opacity: 0; transform: translateY(-6px) scale(.985); transform-origin: top;
  pointer-events: none; transition: opacity .16s, transform .16s;
}
.pxsel__menu.up { top: auto; bottom: calc(100% + 6px); transform-origin: bottom; }
.pxsel.is-open .pxsel__menu { opacity: 1; transform: none; pointer-events: auto; }
.pxsel__opt {
  font-family: inherit; font-size: 13.5px; color: var(--ink-700); font-weight: 500;
  background: transparent; border: 0; border-radius: var(--r-xs); cursor: pointer;
  width: 100%; text-align: left; padding: 9px 11px; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  white-space: nowrap; transition: background .12s, color .12s;
}
.pxsel__opt:hover { background: var(--paper-2); color: var(--ink-900); }
.pxsel__opt.is-sel { background: var(--brand-50); color: var(--brand-600); font-weight: 600; }
.pxsel__ck { width: 15px; height: 15px; opacity: 0; flex: none; }
.pxsel__opt.is-sel .pxsel__ck { opacity: 1; }

/* Inline select: the menu flows in-document (pushes content / grows the card)
   instead of overlaying, so it can't be hidden behind a sticky bottom bar. */
.pxsel--inline .pxsel__menu {
  position: static; opacity: 1; transform: none; pointer-events: auto;
  display: none; box-shadow: none; border: 1px solid var(--line);
  margin-top: 8px; max-height: 320px; min-width: 0;
}
.pxsel--inline.is-open .pxsel__menu { display: block; }
.pxsel--inline .pxsel__opt { padding: 11px 12px; }

/* ---------- Branded date / datetime picker (parkly-datepicker.js) ---------- */
.pxdate { position: relative; display: inline-block; width: 100%; }
.pxdate__btn {
  font-family: inherit; font-size: 14px; color: var(--ink-900); font-weight: 500;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-sm);
  padding: 11px 13px; width: 100%; cursor: pointer; display: flex; align-items: center; gap: 10px;
  transition: border-color .15s, box-shadow .15s; text-align: left;
}
.pxdate__btn:hover { border-color: var(--ink-400); }
.pxdate.is-open .pxdate__btn { border-color: var(--brand-400); box-shadow: var(--ring); }
.pxdate__ic { width: 17px; height: 17px; color: var(--ink-400); flex: none; }
.pxdate__val { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pxdate__pop {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 90; width: 280px; max-width: 86vw;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: var(--sh-pop); padding: 12px; display: none;
}
.pxd-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.pxd-title { font-size: 14px; font-weight: 600; text-transform: capitalize; }
.pxd-nav {
  width: 30px; height: 30px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface);
  color: var(--ink-700); font-size: 17px; line-height: 1; cursor: pointer; transition: background .12s, border-color .12s;
}
.pxd-nav:hover { background: var(--paper-2); border-color: var(--ink-400); }
.pxd-dow { display: grid; grid-template-columns: repeat(7,1fr); gap: 2px; margin-bottom: 4px; }
.pxd-dow span { font-size: 11px; font-weight: 600; color: var(--ink-400); text-align: center; }
.pxd-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 2px; }
.pxd-empty { aspect-ratio: 1; }
.pxd-day {
  aspect-ratio: 1; border: 0; background: transparent; border-radius: var(--r-sm); cursor: pointer;
  font-family: inherit; font-size: 13px; font-weight: 500; color: var(--ink-700);
  font-variant-numeric: tabular-nums; transition: background .12s, color .12s;
}
.pxd-day:hover { background: var(--paper-2); color: var(--ink-900); }
.pxd-day.is-today { box-shadow: inset 0 0 0 1px var(--brand-300); color: var(--brand-600); }
.pxd-day.is-sel { background: var(--brand-500); color: #fff; font-weight: 700; }
.pxd-tlabel { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-400); margin: 12px 0 8px; }
.pxd-times { display: grid; grid-template-columns: repeat(4,1fr); gap: 5px; max-height: 132px; overflow-y: auto; }
.pxd-time {
  border: 1px solid var(--line-2); background: var(--surface); border-radius: var(--r-xs); cursor: pointer;
  font-family: var(--font-mono); font-size: 12px; font-weight: 500; color: var(--ink-700); padding: 7px 4px; transition: all .12s;
}
.pxd-time:hover { border-color: var(--brand-400); color: var(--ink-900); }
.pxd-time.is-sel { background: var(--brand-500); border-color: var(--brand-500); color: #fff; font-weight: 600; }

/* ---------- Branded range picker (parkly-rangepicker.js) ---------- */
.pxrange { position: relative; display: block; width: 100%; }
.pxr-btn {
  font-family: inherit; font-size: 14px; color: var(--ink-900); font-weight: 500;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-sm);
  padding: 12px 14px; width: 100%; cursor: pointer; display: flex; align-items: center; gap: 10px;
  transition: border-color .15s, box-shadow .15s; text-align: left;
}
.pxr-btn:hover { border-color: var(--ink-400); }
.pxrange.is-open .pxr-btn { border-color: var(--brand-400); box-shadow: var(--ring); }
.pxr-btn__ic { width: 18px; height: 18px; color: var(--ink-400); flex: none; }
.pxr-btn__val { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pxr-btn__ph { color: var(--ink-400); }
.pxr-btn__n { color: var(--ink-400); font-weight: 500; }

.pxr-scrim { position: fixed; inset: 0; z-index: 130; background: rgba(22,20,28,.4); }
.pxr-pop {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 131; width: 360px; max-width: 92vw;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--sh-pop); padding: 16px;
}
.pxr-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.pxr-title { font-size: 16px; font-weight: 700; text-transform: capitalize; }
.pxr-nav { width: 34px; height: 34px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface); color: var(--ink-700); font-size: 18px; line-height: 1; cursor: pointer; }
.pxr-nav:hover { background: var(--paper-2); border-color: var(--ink-400); }
.pxr-dow { display: grid; grid-template-columns: repeat(7,1fr); gap: 4px; margin-bottom: 6px; }
.pxr-dow span { font-size: 11px; font-weight: 600; color: var(--ink-400); text-align: center; }
.pxr-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 4px; }
.pxr-empty { aspect-ratio: 1; }
.pxr-day {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  aspect-ratio: 1; border: 1px solid transparent; background: var(--paper-2); border-radius: var(--r-sm);
  cursor: pointer; font-family: inherit; padding: 2px 0; transition: background .12s, border-color .12s, transform .1s;
}
.pxr-day:hover:not(.is-off) { background: var(--surface); border-color: var(--brand-300); }
.pxr-day__n { font-size: 15px; font-weight: 700; color: var(--ink-900); font-variant-numeric: tabular-nums; line-height: 1; }
.pxr-day__p { font-size: 11px; font-weight: 700; color: var(--ink-700); line-height: 1; }
.pxr-day__dot { position: absolute; top: 5px; right: 5px; width: 6px; height: 6px; border-radius: 50%; }
.pxr-day__dot.high { background: var(--occ-low); }
.pxr-day__dot.mid  { background: var(--occ-mid); }
.pxr-day__dot.low  { background: var(--occ-high); }
.pxr-day__dot.off  { background: var(--danger); }
.pxr-day.is-off { opacity: .42; cursor: not-allowed; background: transparent; }
.pxr-day.is-off .pxr-day__dot { display: none; }
.pxr-day.is-in { background: var(--brand-50); }
.pxr-day.is-in .pxr-day__n { color: var(--brand-700); }
.pxr-day.is-in .pxr-day__p { color: var(--brand-600); }
.pxr-day.is-start, .pxr-day.is-end { background: var(--brand-500); border-color: var(--brand-500); }
/* Keep a selected day blue on hover so its white number stays readable. */
.pxr-day.is-start:hover:not(.is-off), .pxr-day.is-end:hover:not(.is-off) { background: var(--brand-600); border-color: var(--brand-600); }
.pxr-day.is-start .pxr-day__n, .pxr-day.is-end .pxr-day__n { color: #fff; }
.pxr-day.is-start .pxr-day__p, .pxr-day.is-end .pxr-day__p { color: rgba(255,255,255,.9); }
.pxr-day.is-start .pxr-day__dot, .pxr-day.is-end .pxr-day__dot { box-shadow: 0 0 0 1.5px #fff; }
.pxr-leg { display: flex; justify-content: center; gap: 16px; margin-top: 12px; font-size: 11.5px; color: var(--ink-500); }
.pxr-leg span { display: inline-flex; align-items: center; gap: 6px; }
.pxr-leg i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.pxr-leg i.high { background: var(--occ-low); }
.pxr-leg i.mid { background: var(--occ-mid); }
.pxr-leg i.low { background: var(--occ-high); }
.pxr-foot { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 14px; }
.pxr-times { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.pxr-time label { display: block; font-size: 12px; font-weight: 600; color: var(--ink-700); margin-bottom: 5px; }
.pxr-hint { font-size: 12.5px; color: var(--ink-500); margin: 0 0 12px; text-align: center; }
.pxr-apply { width: 100%; }

@media (max-width: 600px) {
  .pxr-pop {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto; width: 100%; max-width: 100%;
    border-radius: var(--r-xl) var(--r-xl) 0 0; padding: 16px 18px;
    padding-bottom: calc(18px + env(safe-area-inset-bottom)); max-height: 88vh; overflow-y: auto;
  }
}
@media (min-width: 601px) { .pxr-scrim { display: none; } }

/* Inline mode: range picker lives inside the funnel sheet, no overlay/scrim.
   The calendar flows into the panel and the parent .fn-card handles scrolling. */
.pxrange[data-rp-inline] .pxr-scrim { display: none !important; }
.pxrange[data-rp-inline] .pxr-pop {
  position: static; left: auto; right: auto; bottom: auto; top: auto;
  width: 100%; max-width: 100%; max-height: none; overflow: visible;
  margin-top: 10px; padding: 14px 0 0; padding-bottom: 0;
  background: transparent; border: 0; border-top: 1px solid var(--line);
  border-radius: 0; box-shadow: none;
}

/* ---------- Pills (status) ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 600; line-height: 1;
  padding: 6px 11px 6px 9px; border-radius: var(--r-pill); border: 1px solid transparent;
  white-space: nowrap;
}
.pill__dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.pill--brand   { background: var(--brand-50);  color: var(--brand-600); }
.pill--warning { background: var(--warning-bg); color: var(--warning-ink); }
.pill--success { background: var(--success-bg); color: var(--success-ink); }
.pill--danger  { background: var(--danger-bg);  color: var(--danger-ink); }
.pill--info    { background: var(--info-bg);    color: var(--info-ink); }
.pill--teal    { background: var(--teal-bg);    color: var(--teal-ink); }
.pill--noshow  { background: transparent; color: var(--danger-ink); border: 1px dashed var(--danger); }

/* ---------- Channel / service chips ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 500; color: var(--ink-700);
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-pill);
  padding: 5px 11px;
}
.chip__dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.chip svg { width: 14px; height: 14px; color: var(--ink-500); }

/* ---------- KPI cards ---------- */
.kpi { padding: var(--sp-5); display: flex; flex-direction: column; gap: 10px; }
.kpi__top { display: flex; align-items: center; justify-content: space-between; }
.kpi__label { font-size: 13px; font-weight: 500; color: var(--ink-500); }
.kpi__ic { width: 34px; height: 34px; border-radius: var(--r-sm); display: grid; place-items: center; background: var(--brand-50); color: var(--brand-600); }
.kpi__ic svg { width: 18px; height: 18px; }
.kpi__val { font-size: 30px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi__val small { font-size: 15px; font-weight: 600; color: var(--ink-400); margin-left: 2px; }
.kpi__delta { font-size: 12.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.kpi__delta.up { color: var(--success); }
.kpi__delta.down { color: var(--danger); }

/* ---------- Capacity bar / occupancy ---------- */
.cap { display: flex; flex-direction: column; gap: 10px; }
.cap__head { display: flex; align-items: baseline; justify-content: space-between; }
.cap__pct { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cap__state { font-size: 13px; font-weight: 600; }
.cap__track { height: 12px; border-radius: 999px; background: var(--occ-track); overflow: hidden; }
.cap__fill { height: 100%; border-radius: 999px; transition: width .25s ease, background .25s ease; }
.cap__legend { display: flex; gap: var(--sp-4); flex-wrap: wrap; font-size: 12px; color: var(--ink-500); }
.cap__legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 6px; vertical-align: middle; }
input[type="range"].occ-range { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border-radius: 999px; background: var(--line-2); }
input[type="range"].occ-range::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%; background: var(--surface); border: 2px solid var(--brand-500); box-shadow: var(--sh-2); cursor: pointer; }

/* occupancy heat scale strip */
.heat { display: grid; grid-template-columns: repeat(4,1fr); border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--line); }
.heat__seg { padding: 14px; color: #fff; }
.heat__seg b { display: block; font-size: 14px; }
.heat__seg span { font-size: 12px; opacity: .9; font-variant-numeric: tabular-nums; }

/* ---------- Table ---------- */
.tbl-wrap { border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; background: var(--surface); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl thead th {
  text-align: left; font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--ink-400); padding: 12px 16px; background: var(--paper-2); border-bottom: 1px solid var(--line);
}
.tbl tbody td { padding: 13px 16px; border-bottom: 1px solid var(--line); color: var(--ink-700); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr { transition: background .12s; }
.tbl tbody tr:hover { background: var(--paper-2); }
.tbl .mono { font-family: var(--font-mono); font-size: 12.5px; color: var(--ink-900); }
.tbl .name { font-weight: 600; color: var(--ink-900); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink-900); }

.plate {
  display: inline-flex; align-items: center; font-family: var(--font-mono); font-weight: 600; font-size: 12px;
  background: var(--paper-2); border: 1px solid var(--line-2); border-radius: 5px; padding: 3px 7px; letter-spacing: .04em; color: var(--ink-900); white-space: nowrap;
}

/* ---------- Workflow demo ---------- */
.wf { display: grid; gap: var(--sp-5); }
.wf__current { display: flex; align-items: center; gap: var(--sp-4); flex-wrap: wrap; }
.wf__actions { display: flex; gap: 10px; flex-wrap: wrap; }
.wf-terminal { font-size: 13px; color: var(--ink-400); font-style: italic; }
.wf__log { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0; max-height: 168px; overflow-y: auto; border-top: 1px solid var(--line); }
.wf__log li { display: flex; justify-content: space-between; gap: var(--sp-4); padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 13px; color: var(--ink-700); }
.wf__log time { font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-400); }

/* ---------- Bottom sheet ---------- */
.sheet-scrim {
  position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center;
  background: rgba(22,20,28,.42); opacity: 0; pointer-events: none; transition: opacity .25s;
}
.sheet-scrim.is-open { opacity: 1; pointer-events: auto; }
.sheet {
  width: 100%; max-width: 420px; background: var(--surface);
  border-radius: var(--r-xl) var(--r-xl) 0 0; box-shadow: var(--sh-pop);
  transform: translateY(101%); transition: transform .3s cubic-bezier(.32,.72,0,1);
  padding: var(--sp-3) var(--sp-6) var(--sp-8); max-height: 86vh; overflow-y: auto;
}
.sheet-scrim.is-open .sheet { transform: translateY(0); }
.sheet__grip { width: 38px; height: 4px; border-radius: 999px; background: var(--line-2); margin: 8px auto var(--sp-5); }
.sheet__title { font-size: 18px; font-weight: 700; margin: 0 0 4px; }
.sheet__sub { font-size: 13px; color: var(--ink-500); margin: 0 0 var(--sp-5); }

/* phone frame for the demo */
.phone {
  width: 300px; border: 9px solid var(--ink-900); border-radius: 38px; overflow: hidden;
  background: var(--paper); box-shadow: var(--sh-3); position: relative; height: 600px;
}
.phone__notch { position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 110px; height: 22px; background: var(--ink-900); border-radius: 0 0 13px 13px; z-index: 5; }
.phone__scroll { height: 100%; overflow-y: auto; }

/* ---------- misc ---------- */
.note { font-size: 13px; line-height: 1.55; color: var(--ink-500); }
.kbd { font-family: var(--font-mono); font-size: 11px; background: var(--paper-2); border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 5px; padding: 2px 6px; color: var(--ink-700); }
.divider { height: 1px; background: var(--line); border: 0; margin: var(--sp-10) 0; }
.tag-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

@media (max-width: 920px) {
  .app { grid-template-columns: 1fr; }
  .sidenav { display: none; }
  .canvas { padding: var(--sp-8) var(--sp-5) 100px; }
  .grid-4 { grid-template-columns: repeat(2,1fr); }
  .grid-3 { grid-template-columns: 1fr; }
  .topbar { padding: 12px var(--sp-5); }
}

/* hidden attribute must always win over component display rules */
[hidden] { display: none !important; }

/* ---------- Modal / bottom-sheet dialog (pxDialog / pxConfirm) ---------- */
.pxdlg-scrim {
  position: fixed; inset: 0; z-index: 200; background: rgba(22,20,28,.5);
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.pxdlg-scrim.is-open { opacity: 1; pointer-events: auto; }
.pxdlg {
  position: fixed; z-index: 201; background: var(--surface); box-shadow: var(--sh-pop);
  /* mobile: bottom-sheet */
  left: 0; right: 0; bottom: 0; max-width: 100%;
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  transform: translateY(102%);
  transition: transform .3s cubic-bezier(.32,.72,0,1);
  max-height: 92vh; display: flex; flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom);
}
.pxdlg.is-open { transform: translateY(0); }
.pxdlg__grip { width: 40px; height: 4px; border-radius: 999px; background: var(--line-2); margin: 8px auto 0; flex: none; }
.pxdlg__head {
  display: flex; align-items: flex-start; gap: var(--sp-3);
  padding: 16px 22px 10px;
}
.pxdlg__head h3 { font-size: 18px; font-weight: 600; letter-spacing: -.01em; margin: 0; }
.pxdlg__desc { font-size: 13.5px; color: var(--ink-500); margin: 4px 0 0; line-height: 1.5; }
.pxdlg__close { margin-left: auto; }
.pxdlg__body { padding: 8px 22px 4px; overflow-y: auto; flex: 1 1 auto; }
.pxdlg__foot {
  display: flex; gap: 10px;
  padding: 14px 22px 18px;
  border-top: 1px solid var(--line);
}
.pxdlg__foot .btn { min-height: 48px; }

@media (min-width: 720px) {
  .pxdlg {
    left: 50%; right: auto; top: 50%; bottom: auto;
    transform: translate(-50%, -45%) scale(.98);
    width: 480px; max-width: calc(100vw - 32px);
    border-radius: var(--r-xl);
    max-height: 86vh;
    opacity: 0;
    transition: transform .22s cubic-bezier(.32,.72,0,1), opacity .18s;
  }
  .pxdlg.is-open { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  .pxdlg__grip { display: none; }
  .pxdlg__head { padding: 22px 24px 10px; }
  .pxdlg__body { padding: 8px 24px 4px; }
  .pxdlg__foot { padding: 16px 24px 20px; }
}

/* ---------- Toast (shared feedback) ---------- */
.pxtoast-wrap { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 200;
  display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.pxtoast { display: flex; align-items: center; gap: 10px; background: var(--ink-900); color: #fff;
  font-size: 13.5px; font-weight: 500; padding: 11px 16px; border-radius: var(--r-pill); box-shadow: var(--sh-3);
  opacity: 0; transform: translateY(10px); transition: opacity .2s, transform .2s; max-width: 90vw; }
.pxtoast.show { opacity: 1; transform: none; }
.pxtoast svg { width: 16px; height: 16px; flex: none; }
.pxtoast--ok svg { color: var(--occ-low); }
.pxtoast--err svg { color: var(--danger); }
[data-theme="dark"] .pxtoast { background: var(--surface); color: var(--ink-900); border: 1px solid var(--line); }
