/* PitchButler app design system
 * ---------------------------------------------------------------------------
 * Shopify-admin structure, PitchButler skin. Loaded by base.html on every
 * signed-in page (the staff console inherits it and re-scopes what it needs
 * under .staff-theme).
 *
 * Three parts, in order:
 *   1. Tokens          - the palette, type, radii and shadows, once.
 *   2. Primitives      - .pb-* classes new markup opts into.
 *   3. Legacy re-skin  - the old editorial idiom (2px near-black frames,
 *                        hard offset shadows, indigo Tailwind buttons)
 *                        restyled from one place so the 47 templates that
 *                        extend base.html speak the new language without a
 *                        markup edit.
 *
 * Pure presentation. No JS hooks, ids, hx-* or x-data attributes live here.
 */

/* ========================================================================= */
/* 1. Tokens                                                                  */
/* ========================================================================= */

:root {
  /* Ink scale - warm near-black, the brand's #111010. */
  --pb-ink:    #111010;
  --pb-ink-2:  #3F3C3A;
  --pb-ink-3:  #6B6763;
  --pb-ink-4:  #9A958E;
  --pb-ink-5:  #C9C4BB;

  /* Surfaces - warm paper, not Shopify's cool grey, so the app and the
     landing page share a temperature. */
  --pb-canvas:    #F4F2EE;
  --pb-surface:   #FFFFFF;
  --pb-surface-2: #FAF9F7;
  --pb-sunken:    #EEEBE5;
  --pb-hover:     rgba(17, 16, 16, 0.045);

  --pb-border:    #E6E2DA;
  --pb-border-2:  #D6D1C7;

  /* Brand pastels, each with an AA-safe ink for text on top of it. */
  --pb-pink:       #FFB3C7;
  --pb-pink-ink:   #8A1F3D;
  --pb-lav:        #E3DBFF;
  --pb-lav-ink:    #3F2E8C;
  --pb-mint:       #D6F2DC;
  --pb-mint-ink:   #175A32;
  --pb-butter:     #FFE9A8;
  --pb-butter-ink: #7A4B03;
  --pb-hot:        #E8430F;
  --pb-danger:     #B42318;

  --pb-r:    12px;
  --pb-r-sm: 8px;

  --pb-shadow:      0 1px 2px rgba(17, 16, 16, 0.06);
  --pb-shadow-card: 0 1px 2px rgba(17, 16, 16, 0.06), 0 1px 1px rgba(17, 16, 16, 0.03);
  --pb-shadow-lift: 0 8px 24px rgba(17, 16, 16, 0.10), 0 2px 6px rgba(17, 16, 16, 0.06);
  --pb-shadow-pop:  0 12px 32px rgba(17, 16, 16, 0.14), 0 2px 8px rgba(17, 16, 16, 0.08);

  --pb-topbar:  56px;
  --pb-sidebar: 240px;

  --pb-disp: 'Bricolage Grotesque', 'Instrument Sans', ui-sans-serif, system-ui, sans-serif;
  --pb-sans: 'Instrument Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --pb-mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --pb-spring: cubic-bezier(.34, 1.45, .5, 1);
  --pb-ease:   cubic-bezier(.2, .7, .2, 1);
}

html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body {
  font-family: var(--pb-sans);
  color: var(--pb-ink);
  background-color: var(--pb-canvas);
}
h1, h2, h3 { font-family: var(--pb-disp); letter-spacing: -0.025em; }
h4, h5, h6 { letter-spacing: -0.015em; }
.num, .tnum { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum'; }
::selection { background: var(--pb-ink); color: var(--pb-pink); }

[x-cloak] { display: none !important; }

/* Visible keyboard focus, one recipe everywhere. */
:where(a, button, input, select, textarea, [role="button"], [role="tab"]):focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--pb-ink);
}

/* ========================================================================= */
/* 2. Primitives                                                              */
/* ========================================================================= */

/* ---- App shell ---------------------------------------------------------- */

.pb-app { min-height: 100%; background: var(--pb-canvas); }

.pb-topbar {
  position: sticky; top: 0; z-index: 40;
  height: var(--pb-topbar);
  background: #fff;
  border-bottom: 1px solid var(--pb-border);
}
.pb-topbar__inner {
  height: 100%;
  display: flex; align-items: center; gap: 6px;
  padding: 0 12px;
}
.pb-brand {
  display: inline-flex; align-items: center; gap: 9px;
  height: 38px; padding: 0 10px 0 6px; border-radius: 10px;
  transition: background .12s ease;
}
.pb-brand:hover { background: var(--pb-hover); }
.pb-brand__name {
  font-family: var(--pb-disp); font-weight: 750; font-size: 17px;
  letter-spacing: -0.02em; color: var(--pb-ink); white-space: nowrap;
}

.pb-search { position: relative; flex: 1; min-width: 0; max-width: 520px; margin: 0 auto; }
.pb-search__icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--pb-ink-4); pointer-events: none;
}
.pb-search__input {
  width: 100%; height: 36px;
  padding: 0 44px 0 36px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: var(--pb-sunken);
  font-size: 13.5px; color: var(--pb-ink);
  transition: background .12s ease, border-color .12s ease, box-shadow .12s ease;
}
.pb-search__input::placeholder { color: var(--pb-ink-4); }
.pb-search__input:hover { background: #E8E5DE; }
.pb-search__input:focus {
  outline: none; background: #fff;
  border-color: var(--pb-ink);
  box-shadow: 0 0 0 3px rgba(17, 16, 16, 0.10);
}
.pb-search__kbd {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  font-family: var(--pb-mono); font-size: 10.5px; line-height: 1;
  padding: 4px 6px; border-radius: 6px;
  color: var(--pb-ink-4); background: #fff;
  border: 1px solid var(--pb-border); pointer-events: none;
}

.pb-iconbtn {
  position: relative;
  height: 36px; width: 36px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 10px; color: var(--pb-ink-3);
  transition: background .12s ease, color .12s ease;
}
.pb-iconbtn:hover { background: var(--pb-hover); color: var(--pb-ink); }
.pb-iconbtn__dot {
  position: absolute; top: 6px; right: 6px;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 9999px;
  background: var(--pb-hot); color: #fff;
  font-size: 10px; font-weight: 700; line-height: 16px; text-align: center;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 0 0 2px #fff;
}

.pb-avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 9999px;
  background: var(--pb-pink); color: var(--pb-ink);
  font-size: 11.5px; font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(17, 16, 16, 0.18);
}
.pb-avatar--lg { width: 36px; height: 36px; font-size: 13px; }

.pb-body { display: flex; align-items: flex-start; }

.pb-sidebar {
  width: var(--pb-sidebar); flex: none;
  position: sticky; top: var(--pb-topbar);
  height: calc(100vh - var(--pb-topbar));
  display: flex; flex-direction: column;
  overflow-y: auto;
  padding: 10px 10px 8px;
  border-right: 1px solid var(--pb-border);
  scrollbar-width: thin; scrollbar-color: var(--pb-ink-5) transparent;
}
.pb-sidebar__spacer { flex: 1 1 auto; min-height: 16px; }
.pb-sidebar__foot {
  margin-top: 8px; padding: 10px 10px 2px;
  border-top: 1px solid var(--pb-border);
  display: flex; flex-wrap: wrap; gap: 4px 12px;
  font-size: 11px; color: var(--pb-ink-4);
}
.pb-sidebar__foot a:hover { color: var(--pb-ink); }

.pb-nav-label {
  padding: 16px 10px 6px;
  font-family: var(--pb-mono); font-size: 10.5px; font-weight: 600;
  letter-spacing: .12em; text-transform: uppercase; color: var(--pb-ink-4);
}
.pb-nav-item {
  display: flex; align-items: center; gap: 10px;
  height: 34px; padding: 0 10px; margin-bottom: 1px;
  border-radius: 9px;
  font-size: 13.5px; font-weight: 550; color: var(--pb-ink-2);
  transition: background .12s ease, color .12s ease;
}
.pb-nav-item:hover { background: var(--pb-hover); color: var(--pb-ink); }
.pb-nav-item--active {
  background: #fff; color: var(--pb-ink); font-weight: 650;
  box-shadow: 0 1px 2px rgba(17, 16, 16, 0.08), 0 0 0 1px rgba(17, 16, 16, 0.06);
}
.pb-nav-item__icon { width: 18px; height: 18px; flex: none; color: var(--pb-ink-4); }
.pb-nav-item--active .pb-nav-item__icon { color: var(--pb-ink); }
.pb-nav-item__icon--ai { color: var(--pb-lav-ink); }
.pb-nav-item__label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pb-nav-item__count {
  margin-left: auto; flex: none;
  min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 9999px;
  font-size: 11px; font-weight: 700; line-height: 20px; text-align: center;
  font-variant-numeric: tabular-nums;
  background: var(--pb-butter); color: var(--pb-butter-ink);
}
.pb-nav-item__count--hot { background: var(--pb-pink); color: var(--pb-pink-ink); }
.pb-nav-item__count--quiet { background: var(--pb-sunken); color: var(--pb-ink-3); font-weight: 600; }

.pb-nav-children { position: relative; margin: 1px 0 6px; padding-left: 19px; }
.pb-nav-children::before {
  content: ""; position: absolute; left: 18px; top: 4px; bottom: 4px;
  width: 1px; background: var(--pb-border-2);
}
.pb-nav-child {
  display: flex; align-items: center; gap: 8px;
  height: 30px; padding: 0 10px 0 12px; margin: 0 0 1px 6px;
  border-radius: 8px;
  font-size: 12.75px; font-weight: 500; color: var(--pb-ink-3);
  transition: background .12s ease, color .12s ease;
}
.pb-nav-child:hover { background: var(--pb-hover); color: var(--pb-ink); }
.pb-nav-child--active {
  background: #fff; color: var(--pb-ink); font-weight: 650;
  box-shadow: 0 1px 2px rgba(17, 16, 16, 0.08), 0 0 0 1px rgba(17, 16, 16, 0.06);
}
.pb-nav-child__count {
  margin-left: auto; flex: none;
  font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums;
  color: var(--pb-ink-3);
}
.pb-nav-child__count--hot { color: var(--pb-hot); }

.pb-main { flex: 1 1 auto; min-width: 0; }

/* Mobile drawer (below lg) */
.pb-drawer { position: fixed; inset: 0; z-index: 50; }
.pb-drawer__scrim { position: absolute; inset: 0; background: rgba(17, 16, 16, 0.45); }
.pb-drawer__panel {
  position: absolute; top: 0; bottom: 0; left: 0;
  width: 288px; max-width: 86vw;
  display: flex; flex-direction: column;
  background: var(--pb-canvas);
  box-shadow: var(--pb-shadow-pop);
  overflow-y: auto;
}
.pb-drawer__head {
  height: var(--pb-topbar); flex: none;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 10px 0 14px; border-bottom: 1px solid var(--pb-border);
}
.pb-drawer__panel .pb-sidebar {
  position: static; height: auto; width: auto; border-right: 0; flex: 1;
}

/* Account menu */
.pb-menu {
  position: absolute; right: 0; top: calc(100% + 8px);
  width: 264px; z-index: 50;
  background: #fff; border: 1px solid var(--pb-border);
  border-radius: var(--pb-r); box-shadow: var(--pb-shadow-pop);
  overflow: hidden; transform-origin: top right;
}
.pb-menu__head { padding: 12px 14px 10px; background: var(--pb-surface-2); border-bottom: 1px solid var(--pb-border); }
.pb-menu__section { padding: 6px; }
.pb-menu__section + .pb-menu__section { border-top: 1px solid var(--pb-border); }
.pb-menu__item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; border-radius: 8px;
  font-size: 13px; font-weight: 550; color: var(--pb-ink-2);
  transition: background .12s ease, color .12s ease; text-align: left;
}
.pb-menu__item:hover { background: var(--pb-hover); color: var(--pb-ink); }
.pb-menu__item--active { background: var(--pb-sunken); color: var(--pb-ink); }
.pb-menu__item--danger:hover { background: #FFF0F4; color: var(--pb-danger); }
.pb-menu__icon { width: 16px; height: 16px; flex: none; color: var(--pb-ink-4); }

/* Skip link */
.pb-skip { position: absolute; left: -9999px; top: 8px; z-index: 100; }
.pb-skip:focus {
  left: 12px; padding: 8px 14px; border-radius: 9999px;
  background: var(--pb-ink); color: #fff; font-weight: 600; font-size: 13px;
}

/* ---- Page header --------------------------------------------------------- */

.pb-page-header {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: 12px 16px; margin-bottom: 20px;
}
.pb-page-header__main { min-width: 0; flex: 1 1 320px; }
.pb-back {
  display: inline-flex; align-items: center; gap: 6px;
  margin-bottom: 8px;
  font-size: 12.5px; font-weight: 600; color: var(--pb-ink-3);
}
.pb-back:hover { color: var(--pb-ink); }
.pb-kicker {
  display: inline-flex; align-items: center; gap: 8px;
  margin-bottom: 4px;
  font-family: var(--pb-mono); font-size: 10.5px; font-weight: 600;
  letter-spacing: .14em; text-transform: uppercase; color: var(--pb-ink-4);
}
.pb-kicker::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--pb-pink); }
.pb-page-title {
  margin: 0;
  font-family: var(--pb-disp); font-size: 24px; line-height: 1.15;
  font-weight: 750; letter-spacing: -0.025em; color: var(--pb-ink);
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
}
.pb-page-subtitle { margin-top: 4px; font-size: 13.5px; line-height: 1.5; color: var(--pb-ink-3); max-width: 64ch; }
.pb-page-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

.pb-section-title {
  font-family: var(--pb-disp); font-size: 16px; font-weight: 700;
  letter-spacing: -0.015em; color: var(--pb-ink);
}
.pb-section-hint { margin-top: 2px; font-size: 13px; color: var(--pb-ink-3); }

/* ---- Buttons ------------------------------------------------------------- */

.pb-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 14px;
  border-radius: 9999px;
  font-size: 13px; font-weight: 600; line-height: 1;
  color: var(--pb-ink); background: #fff;
  border: 1px solid var(--pb-border-2);
  box-shadow: 0 1px 1px rgba(17, 16, 16, 0.06);
  white-space: nowrap; cursor: pointer; text-decoration: none;
  transition: transform .15s var(--pb-spring), box-shadow .15s ease, background .15s ease, color .15s ease;
}
.pb-btn:hover { background: var(--pb-surface-2); transform: translateY(-1px); box-shadow: 0 2px 4px rgba(17, 16, 16, 0.10); }
.pb-btn:active { transform: translateY(0); box-shadow: 0 1px 1px rgba(17, 16, 16, 0.06); }
.pb-btn:disabled, .pb-btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }
.pb-btn--primary {
  background: var(--pb-ink); color: #fff; border-color: var(--pb-ink);
  box-shadow: 0 2px 0 rgba(17, 16, 16, 0.28);
}
.pb-btn--primary:hover { background: #000; box-shadow: 0 3px 0 rgba(17, 16, 16, 0.28); }
.pb-btn--primary:active { box-shadow: 0 1px 0 rgba(17, 16, 16, 0.28); }
.pb-btn--danger { color: var(--pb-danger); border-color: rgba(180, 35, 24, 0.35); }
.pb-btn--danger:hover { background: #FFF3F2; }
.pb-btn--plain { background: transparent; border-color: transparent; box-shadow: none; color: var(--pb-ink-2); }
.pb-btn--plain:hover { background: var(--pb-hover); box-shadow: none; transform: none; color: var(--pb-ink); }
.pb-btn--sm { height: 28px; padding: 0 11px; font-size: 12px; }
.pb-btn--lg { height: 40px; padding: 0 18px; font-size: 14px; }
.pb-btn svg { width: 15px; height: 15px; }

/* ---- Badges -------------------------------------------------------------- */

.pb-badge {
  display: inline-flex; align-items: center; gap: 6px;
  height: 22px; padding: 0 9px;
  border-radius: 9999px;
  font-size: 11.5px; font-weight: 600; line-height: 1; white-space: nowrap;
  background: var(--pb-sunken); color: var(--pb-ink-2);
}
.pb-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .7; flex: none; }
.pb-badge--nodot::before { display: none; }
.pb-badge--success   { background: var(--pb-mint);   color: var(--pb-mint-ink); }
.pb-badge--attention { background: var(--pb-butter); color: var(--pb-butter-ink); }
.pb-badge--critical  { background: var(--pb-pink);   color: var(--pb-pink-ink); }
.pb-badge--info      { background: var(--pb-lav);    color: var(--pb-lav-ink); }
.pb-badge--ink       { background: var(--pb-ink);    color: #fff; }
.pb-badge--outline   { background: #fff; box-shadow: inset 0 0 0 1px var(--pb-border-2); }

/* ---- Cards --------------------------------------------------------------- */

.pb-card {
  background: var(--pb-surface);
  border: 1px solid var(--pb-border);
  border-radius: var(--pb-r);
  box-shadow: var(--pb-shadow-card);
}
.pb-card--interactive { transition: box-shadow .15s ease, transform .15s var(--pb-spring); }
.pb-card--interactive:hover { box-shadow: var(--pb-shadow-lift); transform: translateY(-1px); }
.pb-card__head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--pb-border);
}
.pb-card__title { font-size: 13.5px; font-weight: 650; color: var(--pb-ink); letter-spacing: -0.01em; }
.pb-card__hint { font-size: 12.5px; color: var(--pb-ink-3); }
.pb-card__body { padding: 16px; }
.pb-card__foot { padding: 10px 16px; border-top: 1px solid var(--pb-border); background: var(--pb-surface-2); border-radius: 0 0 var(--pb-r) var(--pb-r); }
.pb-card--pink   { background: #FFF5F8; }
.pb-card--lav    { background: #F7F4FF; }
.pb-card--mint   { background: #F1FBF3; }
.pb-card--butter { background: #FFFAEA; }

/* ---- KPI tile ------------------------------------------------------------ */

.pb-kpi {
  position: relative; overflow: hidden;
  background: #fff; border: 1px solid var(--pb-border);
  border-radius: var(--pb-r); padding: 14px 16px 14px 18px;
  box-shadow: var(--pb-shadow-card);
}
.pb-kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--pb-border-2); }
.pb-kpi--pink::before   { background: var(--pb-pink); }
.pb-kpi--lav::before    { background: #BDAEFF; }
.pb-kpi--mint::before   { background: #8FD9A5; }
.pb-kpi--butter::before { background: #F5CF5A; }
.pb-kpi--ink::before    { background: var(--pb-ink); }
.pb-kpi__label { font-size: 12px; font-weight: 600; color: var(--pb-ink-3); }
.pb-kpi__value {
  margin-top: 6px;
  font-family: var(--pb-disp); font-size: 26px; font-weight: 750; line-height: 1;
  letter-spacing: -0.03em; color: var(--pb-ink); font-variant-numeric: tabular-nums;
}
.pb-kpi__hint { margin-top: 6px; font-size: 12px; color: var(--pb-ink-4); }
/* Change vs the previous period (analytics): a small tinted pill under the value. */
.pb-kpi__delta {
  display: inline-flex; align-items: center; gap: 4px;
  margin-top: 8px; padding: 2px 8px; border-radius: 9999px;
  font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums;
  background: var(--pb-sunken); color: var(--pb-ink-3);
}
.pb-kpi__delta--up   { background: var(--pb-mint); color: var(--pb-mint-ink); }
.pb-kpi__delta--down { background: var(--pb-pink); color: var(--pb-pink-ink); }
.pb-kpi__delta--flat { background: var(--pb-sunken); color: var(--pb-ink-3); }
.pb-kpi__spark { margin-top: 10px; width: 100%; height: 28px; display: block; }

/* ---- Filter toolbar (index pages, analytics) ----------------------------- */

.pb-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding: 10px 12px;
  background: #fff; border: 1px solid var(--pb-border);
  border-radius: var(--pb-r); box-shadow: var(--pb-shadow-card);
}
.pb-toolbar .pb-input, .pb-toolbar .pb-select { width: auto; min-width: 150px; height: 32px; }
.pb-toolbar__spacer { flex: 1 1 auto; }
.pb-toolbar__label { font-size: 12px; font-weight: 600; color: var(--pb-ink-3); }

/* Card whose body is a table or list: no padding, rows run edge to edge. */
.pb-card--flush { overflow: hidden; }
.pb-card--flush .pb-card__body { padding: 0; }
.pb-card--flush:has(table) { overflow-x: auto; }

/* Inline-SVG chart colours - no charting library; paint with these classes. */
.pb-chart-current  { fill: var(--pb-ink);   stroke: var(--pb-ink); }
.pb-chart-previous { fill: var(--pb-ink-5); stroke: var(--pb-ink-5); }
.pb-chart-accent   { fill: var(--pb-pink);  stroke: var(--pb-pink); }
.pb-chart-grid     { stroke: var(--pb-border); }
.pb-chart-label    { font-family: var(--pb-mono); font-size: 11px; fill: var(--pb-ink-4); }
.pb-chart-line     { fill: none; stroke: var(--pb-ink); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.pb-chart-line--previous { stroke: var(--pb-ink-5); stroke-dasharray: 3 3; }
.pb-chart-area     { fill: var(--pb-lav); opacity: .6; }

/* ---- Tabs ---------------------------------------------------------------- */

.pb-tabs { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; }
.pb-tab {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 12px; border-radius: 8px;
  font-size: 13px; font-weight: 550; color: var(--pb-ink-3);
  white-space: nowrap; cursor: pointer; background: transparent; border: 0;
  transition: background .12s ease, color .12s ease;
}
.pb-tab:hover { background: var(--pb-hover); color: var(--pb-ink); }
.pb-tab--active { background: var(--pb-sunken); color: var(--pb-ink); font-weight: 650; }
.pb-tab__count {
  font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums;
  padding: 2px 6px; border-radius: 9999px;
  background: rgba(17, 16, 16, 0.06); color: var(--pb-ink-3);
}
.pb-tab--active .pb-tab__count { background: #fff; color: var(--pb-ink); }
/* Line variant - the underline tabs of a detail page. */
.pb-tabs--line { gap: 0; border-bottom: 1px solid var(--pb-border); }
.pb-tabs--line .pb-tab {
  height: 42px; padding: 0 2px; margin-right: 22px; border-radius: 0;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.pb-tabs--line .pb-tab:hover { background: transparent; }
.pb-tabs--line .pb-tab--active { background: transparent; border-bottom-color: var(--pb-ink); }
/* Segmented control - two or three mutually exclusive views. */
.pb-seg { display: inline-flex; padding: 3px; border-radius: 9999px; background: var(--pb-sunken); }
.pb-seg__item {
  height: 28px; padding: 0 12px; border-radius: 9999px; border: 0; cursor: pointer;
  font-size: 12.5px; font-weight: 600; color: var(--pb-ink-3); background: transparent;
  transition: background .12s ease, color .12s ease, box-shadow .12s ease;
}
.pb-seg__item:hover { color: var(--pb-ink); }
.pb-seg__item--active { background: #fff; color: var(--pb-ink); box-shadow: 0 1px 2px rgba(17, 16, 16, 0.10); }

/* ---- Inbox frame (inbox/_shell.html + inbox/_rail.html) ------------------ */

.pb-inbox__head { padding: 24px 16px 0; background: var(--pb-canvas); }
@media (min-width: 640px)  { .pb-inbox__head { padding: 24px 24px 0; } }
@media (min-width: 1024px) { .pb-inbox__head { padding: 24px 32px 0; } }
.pb-page-header--inbox { margin-bottom: 10px; }
.pb-inbox-tabs__scroll { overflow-x: auto; scrollbar-width: none; }
.pb-inbox-tabs__scroll::-webkit-scrollbar { display: none; }
.pb-inbox-tabs .pb-tabs { flex-wrap: nowrap; padding-bottom: 10px; min-width: max-content; }
.pb-inbox-tabs__gap { flex: 1 1 auto; min-width: 12px; }
.pb-inbox__pane { background: #fff; border-top: 1px solid var(--pb-border); min-height: 60vh; }
.pb-tab__icon { display: inline-flex; color: var(--pb-ink-4); }
.pb-tab--active .pb-tab__icon { color: var(--pb-ink); }
.pb-tab__count--hot { background: var(--pb-pink); color: var(--pb-pink-ink); }
.pb-tab--active .pb-tab__count--hot { background: var(--pb-pink); color: var(--pb-pink-ink); }

/* ---- Empty state --------------------------------------------------------- */

.pb-empty { text-align: center; padding: 44px 24px; }
.pb-empty__icon {
  margin: 0 auto 12px; width: 48px; height: 48px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--pb-lav); color: var(--pb-ink);
}
.pb-empty__icon--pink { background: var(--pb-pink); }
.pb-empty__icon--mint { background: var(--pb-mint); }
.pb-empty__icon--butter { background: var(--pb-butter); }
.pb-empty__title { font-family: var(--pb-disp); font-size: 16px; font-weight: 700; color: var(--pb-ink); }
.pb-empty__body { margin: 4px auto 0; font-size: 13.5px; color: var(--pb-ink-3); max-width: 46ch; line-height: 1.5; }
.pb-empty__cta { margin-top: 16px; display: flex; justify-content: center; gap: 8px; }

/* ---- Banners ------------------------------------------------------------- */

.pb-banner {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px; border-radius: var(--pb-r);
  border: 1px solid var(--pb-border); background: #fff;
  font-size: 13px; line-height: 1.5; color: var(--pb-ink-2);
}
.pb-banner__icon { flex: none; margin-top: 1px; width: 18px; height: 18px; }
.pb-banner__body { flex: 1; min-width: 0; }
.pb-banner__title { font-weight: 650; color: var(--pb-ink); }
.pb-banner--info     { background: #F5F2FF; border-color: #DCD3FF; }
.pb-banner--success  { background: #EEFAF1; border-color: #BFE8CB; }
.pb-banner--warning  { background: #FFF7E0; border-color: #F1DA93; }
.pb-banner--critical { background: #FFF0F4; border-color: #FFC2D2; }

/* Full-width system strips (hot lead, impersonation) that sit under the top bar. */
.pb-strip { border-bottom: 1px solid rgba(17, 16, 16, 0.12); }
.pb-strip__inner {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px;
  padding: 8px 16px; font-size: 13px;
}
@media (min-width: 1024px) { .pb-strip__inner { padding: 8px 24px; } }

/* ---- Forms --------------------------------------------------------------- */

.pb-label { display: block; margin-bottom: 6px; font-size: 12.5px; font-weight: 600; color: var(--pb-ink-2); }
.pb-help { margin-top: 5px; font-size: 12px; color: var(--pb-ink-4); }
.pb-input, .pb-select, .pb-textarea {
  width: 100%; border-radius: 9px;
  border: 1px solid var(--pb-border-2); background: #fff;
  font-size: 13.5px; color: var(--pb-ink);
  transition: border-color .12s ease, box-shadow .12s ease;
}
.pb-input, .pb-select { height: 36px; padding: 0 11px; }
.pb-textarea { padding: 9px 11px; min-height: 84px; }
.pb-input:focus, .pb-select:focus, .pb-textarea:focus {
  outline: none; border-color: var(--pb-ink);
  box-shadow: 0 0 0 3px rgba(17, 16, 16, 0.10);
}

/* ---- Tables -------------------------------------------------------------- */

.pb-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.pb-table th {
  padding: 10px 12px; text-align: left;
  font-size: 12px; font-weight: 600; color: var(--pb-ink-3);
  background: var(--pb-surface-2); border-bottom: 1px solid var(--pb-border);
  white-space: nowrap;
}
.pb-table td { padding: 10px 12px; border-bottom: 1px solid var(--pb-border); vertical-align: middle; }
.pb-table tbody tr:last-child td { border-bottom: 0; }
.pb-table tbody tr:hover { background: var(--pb-surface-2); }

/* ---- Keyboard, palette, shortcut sheet ----------------------------------- */

.pb-kbd {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 6px; border: 1px solid var(--pb-border-2);
  background: #fff; color: var(--pb-ink-3);
  font-family: var(--pb-mono); font-size: 10.5px; line-height: 1;
  box-shadow: 0 1px 0 var(--pb-border-2);
}
.pb-greeting {
  display: inline-flex; align-items: center; gap: 8px;
  margin-bottom: 6px;
  font-family: var(--pb-mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--pb-ink-4);
}
.pb-greeting:empty { display: none; }

.pb-palette {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(17, 16, 16, 0.42);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 12vh 16px 16px;
}
.pb-palette__box {
  width: 100%; max-width: 580px;
  background: #fff; border: 1px solid var(--pb-border);
  border-radius: 14px; box-shadow: var(--pb-shadow-pop);
  overflow: hidden;
}
.pb-palette__field {
  display: flex; align-items: center; gap: 10px;
  padding: 0 14px; height: 52px;
  border-bottom: 1px solid var(--pb-border);
  color: var(--pb-ink-4);
}
.pb-palette__field input {
  flex: 1; min-width: 0; height: 100%; border: 0; outline: none;
  font-size: 15px; color: var(--pb-ink); background: transparent;
}
.pb-palette__field input::placeholder { color: var(--pb-ink-4); }
.pb-palette__list { max-height: 46vh; overflow-y: auto; padding: 6px; }
.pb-palette__item {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 9px; cursor: pointer;
  font-size: 13.5px; color: var(--pb-ink);
}
.pb-palette__item--active { background: var(--pb-sunken); }
.pb-palette__label { font-weight: 600; white-space: nowrap; }
.pb-palette__hint { font-size: 12px; color: var(--pb-ink-4); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pb-palette__group { font-family: var(--pb-mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--pb-ink-4); }
.pb-palette__empty { padding: 22px; text-align: center; font-size: 13px; color: var(--pb-ink-4); }
.pb-palette__foot {
  display: flex; gap: 16px; padding: 8px 14px;
  border-top: 1px solid var(--pb-border); background: var(--pb-surface-2);
  font-size: 11.5px; color: var(--pb-ink-4);
}
.pb-palette__foot span { display: inline-flex; align-items: center; gap: 6px; }

.pb-sheet {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(17, 16, 16, 0.42);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.pb-sheet__box {
  width: 100%; max-width: 640px;
  background: #fff; border: 1px solid var(--pb-border);
  border-radius: 14px; box-shadow: var(--pb-shadow-pop);
}
.pb-sheet__head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--pb-border); }
.pb-sheet__title { font-family: var(--pb-disp); font-size: 17px; font-weight: 700; color: var(--pb-ink); }
.pb-sheet__body { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 28px; padding: 14px 18px 18px; }
@media (max-width: 600px) { .pb-sheet__body { grid-template-columns: 1fr; } }
.pb-sheet__group { font-family: var(--pb-mono); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--pb-ink-4); margin: 10px 0 4px; grid-column: 1 / -1; }
.pb-sheet__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 5px 0; font-size: 13px; color: var(--pb-ink-2); }
.pb-sheet__keys { display: inline-flex; gap: 4px; }

/* ---- Toasts (dark, bottom-centre, like the admin bar) ------------------- */

.pb-toast {
  display: flex; align-items: center; gap: 10px;
  min-width: 240px; max-width: 420px;
  padding: 10px 14px; border-radius: 12px;
  background: var(--pb-ink); color: #fff;
  font-size: 13px; font-weight: 550;
  box-shadow: var(--pb-shadow-pop);
}
.pb-toast__dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: #8FD9A5; }
.pb-toast--error .pb-toast__dot { background: #FF8FAD; }
.pb-toast--warning .pb-toast__dot { background: #FFDD6E; }

/* ---- Misc helpers -------------------------------------------------------- */

.scroll-fine { scrollbar-width: thin; scrollbar-color: var(--pb-ink-5) transparent; }
.scroll-fine::-webkit-scrollbar { width: 8px; height: 8px; }
.scroll-fine::-webkit-scrollbar-thumb { background: var(--pb-ink-5); border-radius: 4px; }
.scroll-fine::-webkit-scrollbar-thumb:hover { background: var(--pb-ink-4); }
.scroll-fine::-webkit-scrollbar-track { background: transparent; }

.divider-soft { height: 1px; background: var(--pb-border); }

/* HTMX loading feedback - every button that fires a request shows the
   spinner itself (htmx adds .htmx-request to the triggering element). */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: inline-block; }
button.htmx-request, a.htmx-request, .pb-busy { position: relative; pointer-events: none; opacity: .7; }
button.htmx-request::after, a.htmx-request::after, .pb-busy::after {
  content: ""; position: absolute; right: .55rem; top: 50%;
  width: .8rem; height: .8rem; margin-top: -.4rem;
  border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; animation: pbspin .7s linear infinite;
}
@keyframes pbspin { to { transform: rotate(360deg); } }
.htmx-added { animation: pbFadeIn 0.2s ease-out; }
@keyframes pbFadeIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
.animate-pulse-slow { animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
.skeleton {
  background: linear-gradient(90deg, #EFECE6 25%, #E4E0D8 50%, #EFECE6 75%);
  background-size: 200% 100%; animation: shimmer 1.5s infinite; border-radius: 8px;
}
.page-transition { animation: pageIn 0.18s ease-out; }
@keyframes pageIn { from { opacity: 0; transform: translateY(2px); } to { opacity: 1; transform: translateY(0); } }
@keyframes live-halo { 0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.45); } 50% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); } }
.halo-live { animation: live-halo 2s ease-out infinite; }
@media (prefers-reduced-motion: reduce) {
  button.htmx-request::after, a.htmx-request::after, .pb-busy::after { animation: none; }
  .page-transition, .htmx-added { animation: none; }
  .pb-btn, .pb-card--interactive { transition: none; }
}

/* ========================================================================= */
/* 3. Legacy re-skin                                                          */
/*    The old app drew everything with 2px near-black rules and hard offset  */
/*    shadows. These rules translate that vocabulary in place, so pages that */
/*    have not been rewritten still land in the new system.                  */
/* ========================================================================= */

/* Card idioms. */
.panel, .panel-quiet {
  background: #fff;
  border: 1px solid var(--pb-border);
  border-radius: var(--pb-r);
  box-shadow: var(--pb-shadow-card);
}
.shadow-card { box-shadow: var(--pb-shadow-card) !important; }
.shadow-card-hover, .hover\:shadow-card-hover:hover { box-shadow: var(--pb-shadow-lift) !important; }
.shadow-lift { box-shadow: var(--pb-shadow-lift) !important; }
.shadow-inset-ring { box-shadow: inset 0 0 0 1px var(--pb-border) !important; }
.rounded-2xl { border-radius: var(--pb-r) !important; }
.rounded-3xl { border-radius: 16px !important; }

/* Near-black frames become warm hairlines. */
.border-pb-black, .border-ink-950, .border-ink-900 { border-color: var(--pb-border) !important; }
.border-2.border-pb-black, .border-2.border-ink-950, .border-2.border-ink-900 { border-width: 1px !important; }
.border-b-2.border-pb-black { border-bottom-width: 1px !important; }
.border-t-2.border-pb-black { border-top-width: 1px !important; }
.border-\[1\.5px\] { border-width: 1px !important; }
.divide-pb-black\/10 > :not([hidden]) ~ :not([hidden]),
.divide-ink-100 > :not([hidden]) ~ :not([hidden]),
.divide-ink-200\/60 > :not([hidden]) ~ :not([hidden]),
.divide-gray-100 > :not([hidden]) ~ :not([hidden]),
.divide-gray-200 > :not([hidden]) ~ :not([hidden]) { border-color: var(--pb-border) !important; }
.border-gray-200, .border-gray-100, .border-ink-100, .border-ink-200, .border-ink-200\/70,
.border-slate-200, .border-gray-200\/80, .border-pb-black\/10 { border-color: var(--pb-border) !important; }

/* Rings: the slate/gray/ink hairlines all become the one border colour. */
.ring-slate-200, .ring-slate-200\/70, .ring-slate-200\/80, .ring-slate-100,
.ring-gray-200, .ring-gray-100, .ring-ink-200, .ring-ink-200\/60, .ring-ink-100,
.ring-ink-900\/10, .ring-ink-900\/15, .ring-ink-900\/20, .ring-ink-900\/25, .ring-ink-500\/20,
.ring-pb-black\/10, .ring-black\/5 {
  --tw-ring-color: var(--pb-border) !important;
}
.ring-gray-300, .ring-ink-300, .ring-ink-900\/30, .ring-ink-900\/60 { --tw-ring-color: var(--pb-border-2) !important; }
.ring-pb-black { --tw-ring-color: var(--pb-ink) !important; }

/* Primary actions: every black or indigo Tailwind button becomes the one
   black pill with the soft 2px lift. */
a.bg-indigo-600, button.bg-indigo-600, a.bg-indigo-500, button.bg-indigo-500,
a.bg-indigo-700, button.bg-indigo-700,
a.bg-brand-600, button.bg-brand-600, a.bg-brand-500, button.bg-brand-500, a.bg-brand-700, button.bg-brand-700,
a.bg-pb-black, button.bg-pb-black, a.bg-ink-950, button.bg-ink-950, a.bg-ink-900, button.bg-ink-900 {
  background: var(--pb-ink) !important;
  color: #fff !important;
  border-radius: 9999px !important;
  box-shadow: 0 2px 0 rgba(17, 16, 16, 0.28) !important;
  transform: none;
  transition: transform .15s var(--pb-spring), box-shadow .15s ease, background .15s ease;
}
a.bg-indigo-600:hover, button.bg-indigo-600:hover, a.bg-indigo-500:hover, button.bg-indigo-500:hover,
a.bg-indigo-700:hover, button.bg-indigo-700:hover,
a.bg-brand-600:hover, button.bg-brand-600:hover, a.bg-brand-500:hover, button.bg-brand-500:hover, a.bg-brand-700:hover, button.bg-brand-700:hover,
a.bg-pb-black:hover, button.bg-pb-black:hover, a.bg-ink-950:hover, button.bg-ink-950:hover, a.bg-ink-900:hover, button.bg-ink-900:hover {
  background: #000 !important;
  transform: translateY(-1px);
  box-shadow: 0 3px 0 rgba(17, 16, 16, 0.28) !important;
}
a.bg-indigo-600:active, button.bg-indigo-600:active, a.bg-brand-600:active, button.bg-brand-600:active,
a.bg-pb-black:active, button.bg-pb-black:active, a.bg-ink-950:active, button.bg-ink-950:active {
  transform: translateY(0);
  box-shadow: 0 1px 0 rgba(17, 16, 16, 0.28) !important;
}
/* Semantic coloured buttons keep their meaning (pause = amber, resume =
   green, destroy = red) but join the pill family. */
a.bg-green-600, button.bg-green-600, a.bg-emerald-600, button.bg-emerald-600,
a.bg-yellow-600, button.bg-yellow-600, a.bg-amber-600, button.bg-amber-600,
a.bg-red-600, button.bg-red-600, a.bg-rose-600, button.bg-rose-600 {
  border-radius: 9999px !important;
  box-shadow: 0 1px 1px rgba(17, 16, 16, 0.15) !important;
}
/* Secondary "white with a ring" buttons and the rounded-md family. */
a.rounded-md.bg-white.ring-1, button.rounded-md.bg-white.ring-1,
a.rounded-lg.bg-white.ring-1, button.rounded-lg.bg-white.ring-1 {
  border-radius: 9999px !important;
  box-shadow: 0 1px 1px rgba(17, 16, 16, 0.06) !important;
}
.ghost-btn {
  display: inline-flex; align-items: center; gap: .4rem;
  height: 32px; padding: 0 12px;
  font-size: 12.5px; font-weight: 600; color: var(--pb-ink);
  background: #fff;
  border: 1px solid var(--pb-border-2);
  border-radius: 9999px;
  box-shadow: 0 1px 1px rgba(17, 16, 16, 0.06);
  transition: transform .15s var(--pb-spring), box-shadow .15s ease, background .15s ease;
  white-space: nowrap;
}
.ghost-btn:hover { background: var(--pb-surface-2); transform: translateY(-1px); box-shadow: 0 2px 4px rgba(17, 16, 16, 0.10); }
.ghost-btn:active { transform: translateY(0); box-shadow: 0 1px 1px rgba(17, 16, 16, 0.06); }
.chip {
  display: inline-flex; align-items: center; gap: .5rem;
  background: #fff;
  border: 1px solid var(--pb-border-2);
  border-radius: 9999px;
  padding: 0.3rem 0.7rem;
  font-size: 12px; color: var(--pb-ink);
}

/* Deep-legacy indigo links and form controls (wizards, edit, xray). */
a.text-indigo-600 { color: var(--pb-lav-ink) !important; }
a.text-indigo-600:hover { color: var(--pb-ink) !important; }
.text-brand-700, .text-brand-600 { color: var(--pb-lav-ink) !important; }
input[type="checkbox"].text-indigo-600, input[type="radio"].text-indigo-600,
input[type="checkbox"], input[type="radio"] { accent-color: var(--pb-ink); }
.focus\:ring-indigo-500:focus, .focus\:ring-indigo-600:focus, .focus\:ring-brand-600:focus, .focus\:ring-brand-500:focus,
.focus\:ring-brand-200:focus { --tw-ring-color: rgba(17, 16, 16, 0.75) !important; }
.focus\:border-indigo-500:focus, .focus\:border-indigo-600:focus { border-color: var(--pb-ink) !important; }
/* Underline tabs that still use the indigo active state. */
.border-indigo-500 { border-color: var(--pb-ink) !important; }
.text-indigo-600.border-indigo-500, a.border-indigo-500 { color: var(--pb-ink) !important; }
.bg-indigo-100 { background-color: var(--pb-lav) !important; }
.text-indigo-700 { color: var(--pb-lav-ink) !important; }

/* Tables that live inside cards scroll instead of clipping their right edge. */
.panel:has(table), .panel-quiet:has(table), .shadow-card:has(table) { overflow-x: auto; }
main table thead { border-bottom: 1px solid var(--pb-border); }
main table tbody tr:hover { background: var(--pb-surface-2); }

/* Cool-grey body text from the Tailwind era warms up. */
.text-gray-500, .text-slate-500, .text-ink-500 { color: var(--pb-ink-3) !important; }
.text-gray-400, .text-slate-400, .text-ink-400 { color: var(--pb-ink-4) !important; }
.text-gray-600, .text-slate-600, .text-ink-600 { color: var(--pb-ink-2) !important; }
.text-gray-700, .text-slate-700, .text-ink-700 { color: var(--pb-ink-2) !important; }
.text-gray-900, .text-slate-900, .text-ink-900 { color: var(--pb-ink) !important; }
.bg-gray-50, .bg-slate-50, .bg-ink-50, .bg-ink-50\/60, .bg-gray-50\/60 { background-color: var(--pb-surface-2) !important; }
.bg-gray-100, .bg-slate-100, .bg-ink-100 { background-color: var(--pb-sunken) !important; }
.bg-\[\#F6F4F1\] { background-color: var(--pb-canvas) !important; }
