/* =====================================================================
   TaxPeel app component classes — built on tokens.css.
   These are the building blocks Jinja templates reference via _macros.html.
   ===================================================================== */

/* ── HTMX indicator ──────────────────────────────────────────────── */
.htmx-indicator { opacity: 0; height: 0; overflow: hidden; transition: opacity 200ms ease; }
.htmx-request .htmx-indicator { opacity: 1; height: auto; }
.htmx-request.htmx-indicator { opacity: 1; height: auto; }

/* Small inline spinner for in-flight htmx requests. Tied to the
   .htmx-indicator pattern via context. */
.tp-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--tp-border);
  border-top-color: var(--tp-navy);
  border-radius: 50%;
  animation: tp-spin 800ms linear infinite;
  flex-shrink: 0;
}
@keyframes tp-spin {
  to { transform: rotate(360deg); }
}

/* While an htmx request is in flight, mute disabled buttons clearly. */
button[disabled], .tp-btn[disabled] { opacity: 0.5; cursor: progress; }

/* Pass 1 May 2026: tabular-nums on every kanban metric, lookup row,
   conclusion KPI. Per spec 15.2, the single biggest "draft-looking"
   tell is non-tabular numbers in dense tables. Defensive class +
   element selectors so we don't have to remember per-template. */
.tp-num,
.tp-mono,
.tp-table td,
.tp-table th,
.tp-kanban__metric,
.tp-kanban__deadline,
.tp-kanban__meta,
.tp-conclusion__primary,
.tp-conclusion__secondary,
.tp-countdown__value,
.tp-deadline__value,
.tp-factbox__v {
  font-variant-numeric: tabular-nums;
}

/* ── Methodology popover (matrix cells, drawer methodology section) ── */
.tp-with-popover {
  position: relative;
  cursor: help;
  border-bottom: 1px dotted var(--tp-fg-faint);
}
.tp-with-popover .tp-popover {
  display: none;
  position: absolute;
  z-index: 50;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  min-width: 320px;
  max-width: 460px;
  background: var(--tp-paper);
  border: var(--tp-border-thin);
  border-radius: var(--tp-radius-sm);
  box-shadow: var(--tp-shadow-lg);
  padding: 12px 14px;
  text-align: left;
  font-weight: normal;
  color: var(--tp-fg);
  white-space: normal;
  pointer-events: none;
}
.tp-with-popover:hover .tp-popover,
.tp-with-popover:focus-within .tp-popover {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.tp-popover__title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--tp-navy);
  border-bottom: var(--tp-border-soft-1);
  padding-bottom: 6px;
  margin-bottom: 2px;
}
.tp-popover__row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 12px;
  color: var(--tp-fg);
}
.tp-popover__row--full { flex-direction: column; align-items: stretch; gap: 2px; }
.tp-popover__k {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--tp-fg-subtle);
}
.tp-popover__v { font-weight: 600; color: var(--tp-navy); font-variant-numeric: tabular-nums; }

/* Matrix cells with popovers stay inline — popover anchors to cell. */
.tp-table .tp-with-popover { display: inline-block; }

/* Alpine.js: hide elements with x-cloak until the framework binds. */
[x-cloak] { display: none !important; }

/* Tab-pane fallback when Alpine fails to load: stack them vertically
   with a visible separator so the workspace still readable. Once Alpine
   is alive it controls visibility via x-show, overriding this rule. */
.tp-tab-pane + .tp-tab-pane { margin-top: 32px; padding-top: 24px; border-top: 2px dashed var(--tp-border); }

/* Narrative tab grid layout — moved out of inline style so x-show display:none can override. */
.tp-narrative-grid {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 16px;
  align-items: flex-start;
}

/* Narrative form: textarea body + sticky tone/save footer (per spec 8.1, 8.3). */
.tp-narrative-form { display: flex; flex-direction: column; }
.tp-narrative-form__body { padding: 18px 22px 0; }
.tp-narrative-textarea {
  width: 100%;
  font-family: var(--tp-font-display);
  font-size: 14px;
  line-height: 1.7;
  color: var(--tp-fg);
  border: var(--tp-border-thin);
  border-radius: 3px;
  padding: 14px 16px;
  resize: vertical;
  background: var(--tp-paper);
}
.tp-narrative-textarea::placeholder {
  font-family: var(--tp-font-display);
  font-style: italic;
  color: var(--tp-fg-faint);
  font-size: 14px;
}
.tp-narrative-form__footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  padding: 12px 22px;
  border-top: var(--tp-border-thin);
  background: var(--tp-bg-soft);
  position: sticky;
  bottom: 0;
  z-index: 4;
}

/* Hide number-input arrows for cleaner cell editing. */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type=number] { -moz-appearance: textfield; }

/* ── App shell / topbar ──────────────────────────────────────────── */
.tp-topbar {
  background: var(--tp-paper);
  border-bottom: var(--tp-border-thin);
  padding: 0 28px;
  height: var(--tp-topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 30;
}
.tp-topbar__left  { display: flex; align-items: center; gap: 36px; }
.tp-topbar__brand { display: flex; align-items: center; }
.tp-topbar__brand img { height: 28px; display: block; }
.tp-topbar__nav   { display: flex; gap: 8px; }
/* Pass 1 May 2026: nav adopts the eyebrow style (uppercase tracked) so
   it reads as navigation, not body links. Active tab gets a 2px
   terracotta underline that hangs off the bottom of the topbar. */
.tp-topbar__nav a {
  font-family: var(--tp-font-body);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--tp-fg-subtle);
  padding: 6px 12px;
  padding: 6px 10px;
  border-radius: 3px;
  position: relative;
  border-bottom: none;
  transition: color var(--tp-duration-fast) var(--tp-ease);
}
.tp-topbar__nav a:hover { color: var(--tp-navy); }
.tp-topbar__nav a.is-active { color: var(--tp-navy); }
.tp-topbar__nav a.is-active::after {
  content: '';
  position: absolute;
  left: 10px; right: 10px; bottom: -19px;
  height: 2px;
  background: var(--tp-terra);
}
.tp-topbar__right { display: flex; align-items: center; gap: 8px; }

/* Account cluster: avatar · name · divider · role pill · ghost icon-button */
.tp-account {
  display: flex;
  align-items: center;
  gap: 10px;
}
.tp-account__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--tp-navy);
  color: #fff;
  font-family: var(--tp-font-body);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.tp-account__name {
  font-size: 13px;
  font-weight: 600;
  color: var(--tp-navy);
  line-height: 1.2;
  max-width: 14ch;
}
.tp-account__divider {
  width: 1px;
  height: 22px;
  background: var(--tp-border);
  flex-shrink: 0;
}
.tp-account__role {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--tp-fg-muted);
  background: var(--tp-bg-fill);
  padding: 3px 8px;
  border-radius: var(--tp-radius-sm);
  white-space: nowrap;
}
.tp-account__logout-form { margin: 0; }
.tp-account__logout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--tp-radius-sm);
  color: var(--tp-fg-subtle);
  cursor: pointer;
  transition: color var(--tp-duration-fast) var(--tp-ease),
              background var(--tp-duration-fast) var(--tp-ease),
              border-color var(--tp-duration-fast) var(--tp-ease);
}
.tp-account__logout:hover {
  color: var(--tp-navy);
  background: var(--tp-bg-soft);
  border-color: var(--tp-border-soft);
}
.tp-account__logout:focus-visible {
  outline: 2px solid var(--tp-focus-ring);
  outline-offset: 2px;
}

/* Copy-on-click parcel ID + case number row (per spec 4.5). */
.tp-id-copy {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 3px;
  padding: 1px 6px;
  margin: 0 -6px 3px;
  cursor: pointer;
  font-size: 11px;
  color: var(--tp-fg-subtle);
  transition: background var(--tp-duration-fast) var(--tp-ease),
              border-color var(--tp-duration-fast) var(--tp-ease);
}
.tp-id-copy:hover {
  background: var(--tp-bg-soft);
  border-color: var(--tp-border-soft);
}
.tp-id-copy:focus-visible {
  outline: 2px solid var(--tp-focus-ring);
  outline-offset: 2px;
}
.tp-id-copy__hint {
  font-family: var(--tp-font-body);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--tp-fg-faint);
  opacity: 0;
  transition: opacity var(--tp-duration-fast) var(--tp-ease);
}
.tp-id-copy:hover .tp-id-copy__hint { opacity: 1; }

/* ── Case Detail header (per spec 4.2) ───────────────────────────── */
.tp-case-title {
  font-family: var(--tp-font-display);
  font-size: 28px;
  font-weight: 700;
  color: var(--tp-navy);
  letter-spacing: -0.01em;
  line-height: 1.15;
  margin: 0;
}
.tp-case-meta {
  font-family: var(--tp-font-body);
  font-size: 13px;
  font-weight: 400;
  color: var(--tp-fg-muted);
  line-height: 1.4;
}
.tp-case-meta__sep {
  color: var(--tp-fg-faint);
  margin: 0 6px;
}
}

/* Account cluster: 32px navy avatar + name + 1px divider + role pill +
   ghost icon-button for logout. Single highest-leverage visual fix. */
.tp-topbar__right {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; color: var(--tp-fg);
}
.tp-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--tp-navy); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; letter-spacing: 0.04em;
  flex-shrink: 0;
}
.tp-topbar__name {
  font-size: 13px; font-weight: 600; color: var(--tp-navy);
  line-height: 1; white-space: nowrap;
}
.tp-topbar__divider { width: 1px; height: 18px; background: var(--tp-border); }
.tp-topbar__role {
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--tp-fg-muted);
  background: var(--tp-bg-fill);
  padding: 3px 8px; border-radius: 12px;
}
.tp-topbar__logout {
  background: none; border: none; cursor: pointer;
  color: var(--tp-fg-subtle); padding: 6px;
  border-radius: 3px; line-height: 1;
  transition: background var(--tp-duration-fast) var(--tp-ease),
              color var(--tp-duration-fast) var(--tp-ease);
}
.tp-topbar__logout:hover { background: var(--tp-bg-fill); color: var(--tp-navy); }

/* ── Page container ──────────────────────────────────────────────── */
.tp-page {
  padding: var(--tp-space-5) var(--tp-space-6);
  max-width: var(--tp-container);
  margin: 0 auto;
}
.tp-page--wide {
  max-width: none;
  padding: var(--tp-space-5) var(--tp-space-6);
}

/* ── Cards ───────────────────────────────────────────────────────── */
/* Per spec 1.3: paper page, soft cards. Card frames sit on the paper page
   and tint slightly to read as "writeable surface." Inner shells (e.g.
   .tp-kanban__card) keep paper bg so they still pop on a soft column. */
/* Pass 1 May 2026: page bg is paper-white, cards sit on bg-soft so
   they read as containers without needing heavy borders. Inner cards
   that nest inside a section bump back to paper. */
.tp-card {
  background: var(--tp-bg-soft);
  border: var(--tp-border-thin);
  border-radius: var(--tp-radius-md);
  padding: var(--tp-space-4);
}
.tp-card .tp-card { background: var(--tp-paper); }
.tp-card--flush { padding: 0; }
.tp-card--accent-top { border-top: 2px solid var(--tp-terra); }

.tp-card__header {
  padding: 10px 14px;
  border-bottom: var(--tp-border-soft-1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.tp-card__header--plain { border-bottom: none; }
.tp-card__body { padding: var(--tp-space-4); }

/* ── Buttons ─────────────────────────────────────────────────────── */
/* Per spec 15.3: standardized heights via box-sizing + min-height so the
   border + padding maths land on exact target heights regardless of
   font-rendering. Defaults to md (36px); sm = 28px, lg = 44px. */
.tp-btn {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--tp-font-body);
  font-weight: var(--tp-weight-semibold);
  font-size: 13px;
  line-height: 1;
  min-height: 36px;
  padding: 0 16px;
  border-radius: var(--tp-radius-sm);
  cursor: pointer;
  border: 1px solid transparent;
  transition: background var(--tp-duration) var(--tp-ease),
              border-color var(--tp-duration) var(--tp-ease),
              color var(--tp-duration) var(--tp-ease);
  text-decoration: none;
  white-space: nowrap;
}
.tp-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.tp-btn--sm { min-height: 28px; padding: 0 12px; font-size: 12px; }
.tp-btn--lg { min-height: 44px; padding: 0 24px; font-size: 14px; }

.tp-btn--navy    { background: var(--tp-navy); color: #fff; border-color: var(--tp-navy); }
.tp-btn--navy:hover    { background: var(--tp-navy-700); border-color: var(--tp-navy-700); }
.tp-btn--terra   { background: var(--tp-terra); color: #fff; border-color: var(--tp-terra); }
.tp-btn--terra:hover   { background: var(--tp-terra-400); border-color: var(--tp-terra-400); }
.tp-btn--positive { background: var(--tp-positive); color: #fff; border-color: var(--tp-positive); }
.tp-btn--positive:hover { background: #155b32; border-color: #155b32; }

/* Hover-lift modifier — shadow-sm → shadow-md on hover (per spec 2.6). Used
   for page-primary buttons like Pipeline's "+ New case". */
.tp-btn--lift {
  box-shadow: var(--tp-shadow-sm);
  transition: background var(--tp-duration-fast) var(--tp-ease),
              border-color var(--tp-duration-fast) var(--tp-ease),
              box-shadow var(--tp-duration-fast) var(--tp-ease);
}
.tp-btn--lift:hover { box-shadow: var(--tp-shadow-md); }
.tp-btn--outline { background: var(--tp-paper); color: var(--tp-navy); border-color: var(--tp-navy); }
.tp-btn--outline:hover { background: var(--tp-bg-soft); }
.tp-btn--ghost   { background: transparent; color: var(--tp-navy); border-color: transparent; }
.tp-btn--ghost:hover   { background: var(--tp-bg-fill); }
.tp-btn--soft    { background: var(--tp-bg-fill); color: var(--tp-navy); border-color: var(--tp-border); }
.tp-btn--soft:hover    { background: var(--tp-bg-soft); }
.tp-btn--danger  { background: var(--tp-paper); color: var(--tp-negative); border-color: var(--tp-negative); }
.tp-btn--danger:hover  { background: var(--tp-negative-bg); }

.tp-btn__count {
  font-size: 10px;
  font-weight: 700;
  background: rgba(255,255,255,0.2);
  color: inherit;
  padding: 1px 6px;
  border-radius: 8px;
  font-variant-numeric: tabular-nums;
  border-left: 1px solid rgba(255,255,255,0.25);
  padding-left: 8px;
  margin-left: 4px;
}

/* ── Form controls ───────────────────────────────────────────────── */
.tp-input, .tp-select, .tp-textarea {
  font-family: var(--tp-font-body);
  font-size: 13px;
  padding: 7px 10px;
  border: var(--tp-border-thin);
  border-radius: var(--tp-radius-sm);
  background: var(--tp-paper);
  color: var(--tp-fg);
  outline: none;
  transition: border-color var(--tp-duration-fast) var(--tp-ease);
}
.tp-input:focus, .tp-select:focus, .tp-textarea:focus {
  border-color: var(--tp-focus-ring);
}
.tp-input--num { text-align: right; font-variant-numeric: tabular-nums; }
.tp-input--inline {
  background: transparent;
  border-color: transparent;
  padding: 2px 6px;
}
.tp-input--inline:hover { border-color: var(--tp-border); }
.tp-input--inline:focus { border-color: var(--tp-navy); background: var(--tp-paper); }

/* ── Pills / badges ──────────────────────────────────────────────── */
.tp-pill {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 2px 8px;
  border-radius: 3px;
  background: var(--tp-bg-fill);
  color: var(--tp-fg-muted);
  border: 1px solid var(--tp-border);
  text-transform: uppercase;
}
.tp-pill--block    { background: var(--tp-negative-bg); color: var(--tp-negative); border-color: #e8b8b8; }
.tp-pill--warn     { background: var(--tp-warning-bg);  color: var(--tp-warning-fg); border-color: var(--tp-warning-border); }
.tp-pill--info     { background: var(--tp-bg-fill);     color: var(--tp-navy); border-color: var(--tp-border); }
.tp-pill--positive { background: var(--tp-positive-bg); color: var(--tp-positive); border-color: #b8d8c4; }
.tp-pill--terra    { background: var(--tp-terra-100);   color: var(--tp-terra); border-color: var(--tp-terra-200); }
.tp-pill--solid    { background: var(--tp-navy); color: #fff; border-color: var(--tp-navy); }
.tp-pill--center   { min-width: 52px; text-align: center; }

/* Soft round-cornered count badge for tabs. */
.tp-count {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  background: var(--tp-border-soft);
  color: var(--tp-fg-subtle);
  padding: 1px 6px;
  border-radius: 8px;
  font-variant-numeric: tabular-nums;
  margin-left: 6px;
}
.tp-count--active { background: var(--tp-navy); color: #fff; }

/* ── Status dot ──────────────────────────────────────────────────── */
.tp-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--tp-fg-subtle);
  flex-shrink: 0;
}
.tp-dot--pass    { background: var(--tp-positive); }
.tp-dot--fail    { background: var(--tp-negative); }
.tp-dot--warn    { background: var(--tp-warning); }
.tp-dot--pending { background: var(--tp-fg-subtle); }
/* Per spec 12.4: 8px green dot with a 2px white ring + pulsing halo. The
   ring stacks via two box-shadows: inner = the white ring, outer = the
   animated rgba pulse. */
.tp-dot--live {
  background: var(--tp-positive);
  box-shadow: 0 0 0 2px #fff, 0 0 0 2px rgba(26,107,60,0.4);
  animation: tp-live-pulse 1.6s infinite;
}
@keyframes tp-live-pulse {
  0%   { box-shadow: 0 0 0 2px #fff, 0 0 0 2px rgba(26,107,60,0.4); }
  70%  { box-shadow: 0 0 0 2px #fff, 0 0 0 8px rgba(26,107,60,0); }
  100% { box-shadow: 0 0 0 2px #fff, 0 0 0 2px rgba(26,107,60,0); }
}

/* ── Confidence bar ──────────────────────────────────────────────── */
.tp-conf {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  vertical-align: middle;
}
.tp-conf__bar {
  width: 38px; height: 5px;
  background: var(--tp-border-soft);
  border-radius: 3px;
  overflow: hidden;
}
.tp-conf__fill {
  height: 100%;
  background: var(--tp-positive);
}
.tp-conf__fill--mid  { background: var(--tp-terra); }
.tp-conf__fill--low  { background: var(--tp-warning); }
.tp-conf__num {
  font-size: 11px;
  color: var(--tp-fg-muted);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

/* ── Countdown chip (header) ─────────────────────────────────────── */
.tp-countdown {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  background: var(--tp-bg-soft);
  padding: 4px 10px;
  border-radius: 3px;
  line-height: 1.15;
}
.tp-countdown__eyebrow {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--tp-fg-subtle);
}
.tp-countdown__value {
  font-size: 12px;
  font-weight: 700;
  color: var(--tp-navy);
  font-variant-numeric: tabular-nums;
}
.tp-countdown--overdue { background: var(--tp-negative-bg); }
.tp-countdown--overdue .tp-countdown__value { color: var(--tp-negative); }
.tp-countdown--urgent  { background: var(--tp-terra-100); }
.tp-countdown--urgent  .tp-countdown__value { color: var(--tp-terra); }

/* Inline countdown badge inside a primary button. */
.tp-btn__countdown {
  margin-left: 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  border-left: 1px solid rgba(255,255,255,0.25);
  padding-left: 8px;
  color: var(--tp-navy-200);
}
.tp-btn--terra .tp-btn__countdown { color: rgba(255,255,255,0.85); }

/* ── Tab strip ───────────────────────────────────────────────────── */
.tp-tabs {
  display: flex;
  gap: 0;
  border-bottom: var(--tp-border-thin);
  margin-top: 14px;
}
.tp-tab {
  font-family: var(--tp-font-body);
  font-size: 13px;
  font-weight: 600;
  background: transparent;
  color: var(--tp-fg-subtle);
  border: none;
  border-bottom: 2px solid transparent;
  padding: 10px 16px;
  cursor: pointer;
  margin-bottom: -1px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.01em;
  text-decoration: none;
  transition: color var(--tp-duration-fast) var(--tp-ease);
}
.tp-tab:hover { color: var(--tp-navy); }
.tp-tab.is-active {
  color: var(--tp-navy);
  border-bottom-color: var(--tp-terra);
}

/* ── Doc table (used inside cards) ───────────────────────────────── */
.tp-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--tp-font-body);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.tp-table thead th {
  padding: 10px 12px;
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--tp-fg-subtle);
  border-bottom: var(--tp-border-thin);
  white-space: nowrap;
  background: #fafbfd;
}
.tp-table tbody td {
  padding: 10px 12px;
  font-size: 13px;
  color: var(--tp-fg);
  border-bottom: 1px solid #f4f6fa;
  white-space: nowrap;
}
.tp-table .tp-td--r,
.tp-table th.tp-td--r { text-align: right; }
.tp-table tbody tr:last-child td { border-bottom: none; }
.tp-table tbody tr.is-clickable {
  cursor: pointer;
  transition: background var(--tp-duration-fast) var(--tp-ease);
}
.tp-table tbody tr.is-clickable:hover { background: var(--tp-cream-100); }
/* Per spec 6.4: excluded rows muted, with strikethrough on hover so the
   exclusion reads physically (not just via the small pill). */
.tp-table tbody tr.is-excluded { opacity: 0.5; }
.tp-table tbody tr.is-excluded.is-clickable:hover,
.tp-table tbody tr.is-excluded:hover { text-decoration: line-through; }

.tp-cell-addr__line1 { font-weight: 600; color: var(--tp-navy); }
.tp-cell-addr__line2 { font-size: 11px; color: var(--tp-fg-subtle); margin-top: 1px; }

/* Adjustments-matrix column headers (per spec 7.2). */
.tp-adj-h { vertical-align: bottom; padding-bottom: 8px !important; }
.tp-adj-h__eyebrow {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--tp-fg-subtle);
  margin-bottom: 2px;
}
.tp-adj-h__addr {
  font-family: var(--tp-font-display);
  font-size: 12px;
  font-weight: 700;
  color: var(--tp-navy);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

/* Click-to-edit adjustment cells (Pass 1 May 2026 redesign).
   Display mode is a button styled to look like text so the matrix reads
   as numbers, not form fields. Edit mode swaps in a number input. */
.tp-adj-cell {
  background: transparent;
  border: 1px solid transparent;
  font: inherit;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  text-align: right;
  padding: 4px 8px;
  border-radius: 3px;
  cursor: text;
  color: inherit;
  transition: background var(--tp-duration-fast) var(--tp-ease),
              border-color var(--tp-duration-fast) var(--tp-ease);
}
.tp-adj-cell:hover { background: var(--tp-bg-fill); border-color: var(--tp-border); }
.tp-adj-cell:focus-visible {
  outline: 2px solid var(--tp-focus-ring);
  outline-offset: 1px;
}

/* ── Adjustment matrix value cells (signed money) ────────────────── */
/* Per spec 6.6: negatives (operator's win) terra bold; positives muted
   regular so color carries sign and weight carries importance. */
.tp-val--neg     { color: var(--tp-terra); font-weight: 600; }
.tp-val--pos     { color: var(--tp-fg-muted); font-weight: 400; }
.tp-val--zero    { color: var(--tp-fg-faint); }
.tp-val--strong  { color: var(--tp-navy); font-weight: 700; }

/* ── Fact box (Comp drawer) ──────────────────────────────────────── */
.tp-factbox {
  background: var(--tp-bg-soft);
  border: var(--tp-border-soft-1);
  border-radius: 3px;
  padding: 8px 10px;
}
.tp-factbox__k {
  font-size: 10px;
  color: var(--tp-fg-subtle);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.tp-factbox__v {
  font-size: 14px;
  color: var(--tp-navy);
  font-weight: 700;
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}

/* ── Collapsible section (left & right rails) ────────────────────── */
.tp-section {
  border-bottom: var(--tp-border-soft-1);
}
.tp-section__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 11px 18px;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  font-family: var(--tp-font-body);
}
.tp-section__head:hover { background: var(--tp-bg-soft); }
.tp-section__title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: var(--tp-tracking-eyebrow);
  text-transform: uppercase;
  color: var(--tp-navy);
  display: flex;
  align-items: center;
  gap: 6px;
}
.tp-section__caret {
  display: inline-block;
  transition: transform var(--tp-duration-fast) var(--tp-ease);
  color: var(--tp-fg-subtle);
  font-size: 12px;
  line-height: 1;
}
.tp-section[open] > .tp-section__head .tp-section__caret { transform: rotate(90deg); }
.tp-section__count {
  font-size: 11px;
  color: var(--tp-fg-subtle);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.tp-section__body { padding: 4px 18px 14px; }

/* details > summary plumbing */
details.tp-section > summary { list-style: none; }
details.tp-section > summary::-webkit-details-marker { display: none; }

/* ── Workflow checklist (left rail) ──────────────────────────────── */
.tp-checklist__progress {
  height: 4px;
  background: var(--tp-border-soft);
  margin: 0 0 12px;
  border-radius: 2px;
  overflow: hidden;
}
.tp-checklist__progress-fill {
  height: 100%;
  background: var(--tp-terra);
  border-radius: 2px;
}
.tp-checklist__item {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 8px;
  padding: 6px 18px 6px 14px;
  align-items: center;
  margin-left: -18px;
  margin-right: -18px;
  border-left: 2px solid transparent;
  font-size: 12px;
}
.tp-checklist__item--current {
  background: var(--tp-terra-100);
  border-left-color: var(--tp-terra);
}
.tp-checklist__item--current .tp-checklist__label { color: var(--tp-navy); font-weight: 600; }
.tp-checklist__item--done    .tp-checklist__label { color: var(--tp-fg-subtle); text-decoration: line-through; }
.tp-checklist__bullet {
  width: 16px; height: 16px;
  border-radius: 8px;
  border: 1.5px solid #ccc;
  background: transparent;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 4px;
}
.tp-checklist__item--done .tp-checklist__bullet { background: var(--tp-positive); border-color: var(--tp-positive); }
.tp-checklist__item--current .tp-checklist__bullet { background: #fff; }
.tp-checklist__label { color: var(--tp-fg-muted); }

/* ── Deadline tile (per spec 13.3) ──────────────────────────────── */
/* Tinted by urgency: cream-100 normal, terra-100 urgent, negative-bg overdue.
   tp-deadline--tbd (per 13.4) deemphasizes value but keeps the cream tint. */
.tp-deadline {
  background: var(--tp-cream-100);
  border: var(--tp-border-soft-1);
  border-radius: 3px;
  padding: 8px 10px;
}
.tp-deadline--overdue { background: var(--tp-negative-bg); border-color: transparent; }
.tp-deadline--urgent  { background: var(--tp-terra-100);  border-color: transparent; }
.tp-deadline__label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--tp-fg-subtle);
}
.tp-deadline__value {
  font-size: 13px;
  color: var(--tp-navy);
  font-weight: 700;
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}
.tp-deadline--overdue .tp-deadline__value { color: var(--tp-negative); }
.tp-deadline--urgent  .tp-deadline__value { color: var(--tp-terra); }
/* Per spec 13.4: TBD placeholders deemphasize. */
.tp-deadline--tbd .tp-deadline__value {
  color: var(--tp-fg-faint);
  font-weight: 400;
  font-style: italic;
}

/* ── Meta row (left rail) ────────────────────────────────────────── */
.tp-meta-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  padding: 3px 0;
}
.tp-meta-row__k { color: var(--tp-fg-subtle); }
.tp-meta-row__v { color: var(--tp-navy); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ── AI summary banner ───────────────────────────────────────────── */
.tp-ai-banner {
  background: var(--tp-cream-100);
  border: 1px solid var(--tp-warning-border);
  border-left: 3px solid var(--tp-terra);
  border-radius: 3px;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}
.tp-ai-banner__body { flex: 1; min-width: 0; }
.tp-ai-banner__eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--tp-navy);
  margin-bottom: 4px;
}
.tp-ai-banner__eyebrow .tp-spark { color: var(--tp-terra); }
.tp-ai-banner__text {
  font-size: 13px;
  color: var(--tp-fg);
  line-height: 1.55;
}
.tp-ai-banner__text strong { color: var(--tp-navy); font-weight: 700; }
.tp-ai-banner__text .tp-pop { color: var(--tp-terra); font-weight: 700; }

.tp-ai-banner__actions { display: flex; gap: 6px; flex-shrink: 0; }

/* Suggested-edit card (narrative sidebar) — per spec 8.2 */
.tp-suggest {
  background: var(--tp-paper);
  border-left: 3px solid var(--tp-terra);
  border-radius: 0 var(--tp-radius-sm) var(--tp-radius-sm) 0;
  padding: 10px 12px 12px;
  margin-bottom: 10px;
  font-family: var(--tp-font-display);
  font-size: 13px;
  color: var(--tp-fg);
  line-height: 1.5;
  box-shadow: var(--tp-shadow-sm);
}
.tp-suggest .tp-spark { color: var(--tp-terra); font-weight: 700; margin-right: 4px; }
.tp-suggest__actions {
  margin-top: 8px;
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

/* ── Conclusion card (navy) ──────────────────────────────────────── */
.tp-conclusion {
  background: var(--tp-navy);
  color: #fff;
  border-radius: 3px;
  border: 1px solid var(--tp-navy);
  padding: 14px 20px;
}
.tp-conclusion__grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr auto;
  gap: 24px;
  align-items: center;
}
/* Per spec 6.7: CTA lives in the page header only — bottom strip is read-only. */
.tp-conclusion__grid--no-cta {
  grid-template-columns: 1.4fr 1fr 1fr;
}
.tp-conclusion__pending {
  text-align: center;
  padding: 4px 0;
}
.tp-conclusion__pending-msg {
  font-family: var(--tp-font-display);
  font-size: 14px;
  font-style: italic;
  color: var(--tp-navy-200);
  margin-top: 6px;
}
.tp-conclusion__eyebrow {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--tp-navy-300);
  margin-bottom: 4px;
}
.tp-conclusion__primary {
  font-family: var(--tp-font-display);
  font-size: 28px;
  font-weight: 700;
  color: var(--tp-terra-warm);
  letter-spacing: -0.02em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.tp-conclusion__secondary {
  font-family: var(--tp-font-display);
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  font-variant-numeric: tabular-nums;
}
.tp-conclusion__sub {
  font-size: 12px;
  color: var(--tp-navy-200);
  margin-top: 4px;
}

/* ── Issue / gate list rows inside health cards (per spec 6.2) ──── */
/* Compressed shape: PILL · headline (truncated) + mono code · action.
   Cap at 3, expand the rest via tp-issue-row__more. */
.tp-issue-row,
.tp-gate-row {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 8px 14px;
  border-bottom: var(--tp-border-soft-1);
  font-size: 12px;
  color: var(--tp-fg);
  line-height: 1.4;
}
.tp-issue-row:last-child,
.tp-gate-row:last-child { border-bottom: none; }
.tp-issue-row__body { min-width: 0; }
.tp-issue-row__msg {
  font-weight: 600;
  color: var(--tp-fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tp-issue-row__code {
  font-family: var(--tp-font-mono);
  font-size: 10px;
  color: var(--tp-fg-subtle);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tp-issue-row__action {
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.tp-issue-row__dismiss {
  cursor: pointer;
  font-size: 11px;
  color: var(--tp-fg-subtle);
  list-style: none;
  padding: 2px 4px;
  border-radius: 3px;
}
.tp-issue-row__dismiss::-webkit-details-marker { display: none; }
.tp-issue-row__dismiss:hover { color: var(--tp-navy); background: var(--tp-bg-soft); }

/* "+N more" expander wrapper for issues + gates panels. */
.tp-issue-row__more { margin: 0; }
.tp-issue-row__more > summary {
  cursor: pointer;
  list-style: none;
  padding: 8px 14px;
  font-size: 11px;
  font-weight: 600;
  color: var(--tp-fg-subtle);
  border-top: var(--tp-border-soft-1);
}
.tp-issue-row__more > summary::-webkit-details-marker { display: none; }
.tp-issue-row__more > summary:hover { color: var(--tp-navy); background: var(--tp-bg-soft); }
.tp-issue-row__more[open] > summary { color: var(--tp-navy); }

/* ── Right-rail assistant chat ───────────────────────────────────── */
.tp-rail--right {
  border-left: var(--tp-border-thin);
  background: #fafbfd;
  display: flex;
  flex-direction: column;
}
.tp-rail--left {
  border-right: var(--tp-border-thin);
  background: var(--tp-paper);
}
.tp-assistant {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.tp-assistant__head {
  padding: 12px 16px;
  border-bottom: var(--tp-border-soft-1);
  background: var(--tp-paper);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.tp-assistant__head-left { display: flex; align-items: center; gap: 8px; }
.tp-assistant__head-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--tp-navy);
}
.tp-assistant__head-sub { font-size: 10px; color: var(--tp-fg-subtle); }

.tp-assistant__thread {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 200px;
}
.tp-msg {
  max-width: 88%;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12.5px;
  line-height: 1.5;
}
.tp-msg--user {
  align-self: flex-end;
  background: var(--tp-navy);
  color: #fff;
}
.tp-msg--assistant {
  align-self: flex-start;
  background: var(--tp-paper);
  border: var(--tp-border-soft-1);
  color: var(--tp-fg);
}
.tp-msg--assistant .tp-spark { color: var(--tp-terra); font-weight: 700; margin-right: 4px; }

.tp-assistant__chips {
  padding: 6px 14px 0;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.tp-chip {
  font-family: var(--tp-font-body);
  font-size: 11px;
  font-weight: 600;
  background: var(--tp-paper);
  color: var(--tp-navy);
  border: var(--tp-border-thin);
  padding: 4px 10px;
  border-radius: 12px;
  cursor: pointer;
  transition: background var(--tp-duration-fast) var(--tp-ease);
  text-align: left;
}
.tp-chip:hover { background: var(--tp-bg-soft); }
.tp-chip:focus-visible {
  outline: 2px solid var(--tp-focus-ring);
  outline-offset: 2px;
}
/* Block variant — fills its row in the assistant empty state. */
.tp-chip--block {
  display: block;
  width: 100%;
  padding: 8px 12px;
  font-size: 12px;
}

/* Empty-state card for the assistant rail (per spec 12.1). */
.tp-assistant__empty {
  background: var(--tp-cream-100);
  border: 1px solid var(--tp-cream-200);
  border-radius: var(--tp-radius-md);
  padding: 14px;
  margin: auto 4px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.tp-assistant__empty-eyebrow { color: var(--tp-fg-subtle); }
.tp-assistant__empty-prompts {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.tp-assistant__empty-hint {
  font-size: 11px;
  color: var(--tp-fg-subtle);
  font-style: italic;
}

.tp-assistant__input {
  padding: 12px;
  border-top: var(--tp-border-soft-1);
  background: var(--tp-paper);
}
.tp-assistant__input form {
  display: flex;
  gap: 6px;
  align-items: flex-end;
}
.tp-assistant__input textarea {
  flex: 1;
  resize: none;
  font-family: var(--tp-font-body);
  font-size: 13px;
  padding: 8px 10px;
  border: var(--tp-border-thin);
  border-radius: 3px;
  outline: none;
  color: var(--tp-fg);
  min-height: 56px;
}
.tp-assistant__input textarea:focus { border-color: var(--tp-focus-ring); }

/* ── Audit log entries ───────────────────────────────────────────── */
.tp-audit {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
}
.tp-audit__entry {
  border-left: 2px solid var(--tp-border);
  padding-left: 10px;
}
.tp-audit__entry--human { border-left-color: var(--tp-terra); }
.tp-audit__meta {
  font-size: 11px;
  color: var(--tp-fg-subtle);
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.tp-audit__who--human  { color: var(--tp-navy); font-weight: 600; }
.tp-audit__who--system { color: var(--tp-fg-subtle); font-weight: 600; }
.tp-audit__action { font-size: 12px; color: var(--tp-fg); margin-top: 1px; }
.tp-audit__detail {
  font-size: 11px;
  color: var(--tp-fg-muted);
  font-family: var(--tp-font-mono);
  margin-top: 1px;
  word-break: break-word;
  white-space: pre-wrap;
}

/* ── Comms tile ──────────────────────────────────────────────────── */
.tp-comms { display: flex; flex-direction: column; gap: 10px; max-height: 260px; overflow-y: auto; }
.tp-comm {
  background: var(--tp-paper);
  border: var(--tp-border-soft-1);
  border-radius: 3px;
  padding: 8px 10px;
}
.tp-comm--you      { background: var(--tp-cream-100); }
.tp-comm--external { background: var(--tp-terra-100); }

/* ── Comp drawer ─────────────────────────────────────────────────── */
.tp-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(26, 39, 68, 0.35);
  z-index: 60;
}
.tp-drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 480px;
  max-width: 100vw;
  background: var(--tp-paper);
  border-left: var(--tp-border-thin);
  z-index: 61;
  display: flex;
  flex-direction: column;
  box-shadow: var(--tp-shadow-drawer);
}
.tp-drawer__header {
  padding: 18px 22px;
  border-bottom: var(--tp-border-soft-1);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.tp-drawer__close {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  padding: 0;
  color: var(--tp-fg-subtle);
}
.tp-drawer__close:hover { color: var(--tp-navy); }
.tp-drawer__body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 18px 22px;
  /* Allow the body to shrink below content height so the footer stays
     visible on short viewports — otherwise the footer (Exclude/Fetch
     buttons) gets pushed off-screen on standard laptop displays. */
  min-height: 0;
  /* Pad the bottom so the last action row clears any floating UI when
     scrolled fully. */
  padding-bottom: 28px;
}
.tp-drawer__footer {
  border-top: var(--tp-border-soft-1);
  padding: 12px 22px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  /* Pin the footer so action buttons remain reachable even on short
     viewports where the body scrolls. */
  flex-shrink: 0;
  background: var(--tp-paper);
}
/* The drawer's slot wrapper has to participate in the column flex chain
   itself; otherwise the inner .tp-drawer__body's flex:1 has no parent
   sizing context and the footer overflows past the viewport. */
#comp-drawer-body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.tp-include-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-radius: 3px;
  margin-bottom: 16px;
  background: var(--tp-positive-bg);
}
.tp-include-banner--excluded { background: var(--tp-negative-bg); }
.tp-include-banner__title {
  font-size: 12px;
  font-weight: 700;
  color: var(--tp-positive);
}
.tp-include-banner--excluded .tp-include-banner__title { color: var(--tp-negative); }
.tp-include-banner__sub { font-size: 11px; color: var(--tp-fg-muted); margin-top: 2px; }

/* ── Tab bar nested below tabs (filings list etc) ────────────────── */
.tp-list-row {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 14px;
  align-items: center;
  padding: 12px 18px;
  border-bottom: var(--tp-border-soft-1);
}
.tp-list-row:last-child { border-bottom: none; }

/* ── Photo placeholder grid ──────────────────────────────────────── */
.tp-photos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.tp-photo {
  border: var(--tp-border-thin);
  border-radius: 3px;
  overflow: hidden;
  background: var(--tp-paper);
}
.tp-photo__img {
  height: 140px;
  background: repeating-linear-gradient(45deg, #eef0f4 0, #eef0f4 8px, #f8f9fc 8px, #f8f9fc 16px);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--tp-fg-faint);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
}
.tp-photo__caption { padding: 8px 12px; font-size: 12px; color: var(--tp-navy); font-weight: 600; }

/* Phase C — real photo grid (replaces the hatch placeholder grid). */
.tp-photo-grid {
  list-style: none;
  margin: 0;
  padding: 14px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.tp-photo-grid .tp-photo {
  display: flex;
  flex-direction: column;
  background: var(--tp-paper);
}
.tp-photo-grid .tp-photo__img {
  height: 140px;
  background: var(--tp-bg-soft);
  overflow: hidden;
}
.tp-photo__meta {
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-top: var(--tp-border-soft-1);
}
.tp-photo__row {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.tp-photo__drag {
  margin-left: auto;
  cursor: grab;
  user-select: none;
  color: var(--tp-fg-subtle);
  font-size: 14px;
  padding: 0 4px;
}
.tp-photo__drag:active { cursor: grabbing; }

/* Sortable.js drag affordance */
.tp-photo.sortable-ghost { opacity: 0.4; }
.tp-photo.sortable-chosen { box-shadow: var(--tp-shadow-md); }
.tp-photo.sortable-drag   { opacity: 0.9; }

/* ── Keyboard-hint chips (per spec 7.4) ──────────────────────────── */
/* Used in eyebrow `right=` slots to surface inline keyboard shortcuts. */
.tp-kbd-hints {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--tp-fg-muted);
}
.tp-kbd-hints__sep { color: var(--tp-fg-faint); margin: 0 4px; }
.tp-kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  padding: 1px 5px;
  font-family: var(--tp-font-mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--tp-fg);
  background: var(--tp-paper);
  border: 1px solid var(--tp-border);
  border-bottom-width: 2px;
  border-radius: 3px;
  line-height: 1.2;
}

/* ── Loading skeletons (per spec 15.6) ──────────────────────────── */
/* Shimmering placeholder rows for in-flight or initial-load states.
   Drop `tp-skeleton-rows` containing N `tp-skeleton-row` blocks; vary
   `tp-skeleton-block--*` widths inside for organic shapes. */
.tp-skeleton-rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
}
.tp-skeleton-row {
  display: flex;
  gap: 12px;
  align-items: center;
}
.tp-skeleton-block {
  height: 12px;
  background: linear-gradient(
    90deg,
    var(--tp-bg-fill) 0%,
    var(--tp-border-soft) 50%,
    var(--tp-bg-fill) 100%
  );
  background-size: 200% 100%;
  border-radius: 3px;
  animation: tp-shimmer 1.4s ease-in-out infinite;
}
.tp-skeleton-block--xs { width: 40px; }
.tp-skeleton-block--sm { width: 80px; }
.tp-skeleton-block--md { width: 140px; }
.tp-skeleton-block--lg { width: 220px; flex: 1; }
.tp-skeleton-block--full { flex: 1; }
@keyframes tp-shimmer {
  0%   { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .tp-skeleton-block { animation: none; }
}

/* ── Signal dashboard (per spec 14.1) ────────────────────────────── */
/* 2×2 grid of horizontal-bar cards. Pure CSS, no chart library. */
.tp-sig-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 18px;
}
.tp-sig-lead {
  font-size: 14px;
  color: var(--tp-fg-muted);
  margin: 6px 0 0;
  max-width: 60ch;
  line-height: 1.5;
}
.tp-sig-header__actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.tp-sig-range {
  font-family: var(--tp-font-body);
  font-size: 12px;
  font-weight: 600;
  color: var(--tp-navy);
  background: var(--tp-paper);
  border: var(--tp-border-thin);
  border-radius: var(--tp-radius-sm);
  padding: 6px 28px 6px 12px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' fill='none' stroke='%231a2744' stroke-width='1.5'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.tp-sig-range:focus-visible {
  outline: 2px solid var(--tp-focus-ring);
  outline-offset: 2px;
}

.tp-sig-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
@media (max-width: 1100px) {
  .tp-sig-grid { grid-template-columns: 1fr; }
}

.tp-sig-card {
  background: var(--tp-bg-soft);
  border: var(--tp-border-thin);
  border-radius: var(--tp-radius-md);
  padding: 16px;
  min-height: 200px;
}
.tp-sig-card__title { margin-bottom: 14px; }
.tp-sig-empty {
  font-size: 12px;
  color: var(--tp-fg-faint);
  font-style: italic;
  margin: 4px 0 0;
}

.tp-sig-bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.tp-sig-row {
  display: grid;
  grid-template-columns: 130px 1fr 40px;
  gap: 10px;
  align-items: center;
  font-size: 12px;
}
.tp-sig-row__label {
  color: var(--tp-fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tp-sig-row__track {
  height: 8px;
  background: var(--tp-bg-fill);
  border-radius: 4px;
  overflow: hidden;
}
.tp-sig-row__fill {
  height: 100%;
  background: var(--tp-navy);
  border-radius: 4px;
  transition: width var(--tp-duration) var(--tp-ease);
}
.tp-sig-row__fill--terra { background: var(--tp-terra); }
.tp-sig-row__n {
  text-align: right;
  font-weight: 700;
  color: var(--tp-fg);
  font-variant-numeric: tabular-nums;
}

/* ── Reviewer-score sliders (per spec 11.2) ─────────────────────── */
/* Navy track-fill, --tp-bg-fill track-empty, navy thumb w/ white inner ring.
   Browsers don't share a slider model, so we style each engine's track and
   thumb separately. The fill ratio is computed inline via a CSS variable. */
.tp-filings-grid input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 22px;
  background: transparent;
  cursor: pointer;
  --range-pct: 50%;
}
.tp-filings-grid input[type="range"]:focus { outline: none; }
.tp-filings-grid input[type="range"]:focus-visible {
  outline: 2px solid var(--tp-focus-ring);
  outline-offset: 4px;
  border-radius: 3px;
}

/* WebKit / Blink */
.tp-filings-grid input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(
    to right,
    var(--tp-navy) 0%,
    var(--tp-navy) var(--range-pct),
    var(--tp-bg-fill) var(--range-pct),
    var(--tp-bg-fill) 100%
  );
}
.tp-filings-grid input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--tp-navy);
  border: 3px solid #fff;
  box-shadow: 0 0 0 1px var(--tp-navy);
  margin-top: -6px;
}

/* Firefox */
.tp-filings-grid input[type="range"]::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background: var(--tp-bg-fill);
}
.tp-filings-grid input[type="range"]::-moz-range-progress {
  height: 4px;
  border-radius: 2px;
  background: var(--tp-navy);
}
.tp-filings-grid input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--tp-navy);
  border: 3px solid #fff;
  box-shadow: 0 0 0 1px var(--tp-navy);
}

/* ── Filings tab layout (per spec 11.1) ──────────────────────────── */
/* 2-col: left = Packets list, right = single Review card with internal
   section dividers between Status and Reviewer scores. */
.tp-filings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
  align-items: flex-start;
}
.tp-filings-grid__main { min-width: 0; }
.tp-filings-grid__side { min-width: 0; }
.tp-filings-review__section { padding: 14px 18px; }
.tp-filings-review__section + .tp-filings-review__section {
  border-top: var(--tp-border-soft-1);
}
@media (max-width: 1100px) {
  .tp-filings-grid { grid-template-columns: 1fr; }
}

/* Section spacer between subject + per-comp sections */
.tp-photo-sections { display: flex; flex-direction: column; gap: 16px; }

/* Per spec 9.1: subject section gets a 2px terra top border so the eye lands
   there first; comp sections keep the default plain border. */
[data-photo-section][data-role="subject"] {
  border-top: 2px solid var(--tp-terra);
}

/* Per spec 9.3: MAPBOX attribution is faint tracked uppercase, not a pill —
   source shouldn't compete with the content. */
.tp-photo__source {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--tp-fg-faint);
}

/* ── Evidence tab (per spec 10.1, 10.2, 10.3) ───────────────────── */
/* 3-zone header: eyebrow left, Live indicator center, buttons right. */
.tp-evidence-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 10px 14px;
  border-bottom: var(--tp-border-soft-1);
  background: var(--tp-paper);
}
.tp-evidence-header__live {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-self: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--tp-positive);
  letter-spacing: 0.04em;
}
.tp-evidence-header__actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* Per spec 10.2: stage uses the cream-100 token, distinctly warm. */
.tp-evidence-stage {
  background: var(--tp-cream-100);
  padding: 24px;
  display: flex;
  justify-content: center;
}
.tp-evidence-paper {
  width: 612px;
  max-width: 100%;
  min-height: 760px;
  background: var(--tp-paper);
  box-shadow: 0 4px 20px rgba(26, 39, 68, 0.15);
  padding: 50px 56px;
  font-family: var(--tp-font-display);
}

/* Per spec 10.3: empty narrative state in PDF — tinted callout with terra
   left border, italic body, inline link to the Narrative tab. */
.tp-evidence-empty {
  background: var(--tp-cream-200);
  border-left: 3px solid var(--tp-terra);
  border-radius: 0 3px 3px 0;
  padding: 10px 14px;
  font-size: 12px;
  font-style: italic;
  color: var(--tp-fg);
  line-height: 1.5;
}
.tp-evidence-empty a {
  color: var(--tp-terra);
  font-weight: 700;
  font-style: normal;
  text-decoration: none;
}
.tp-evidence-empty a:hover { text-decoration: underline; }

/* ── Pipeline kanban ─────────────────────────────────────────────── */
.tp-kanban {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 12px;
}
.tp-kanban__col {
  background: var(--tp-bg-soft);
  border: var(--tp-border-soft-1);
  border-radius: var(--tp-radius-sm);
  padding: 8px;
  min-height: 200px;
}
/* Deals board: the card list fills the column so the whole column is a drop
   target, not just the few pixels the cards occupy. */
.tp-kanban--deals .tp-kanban__col { display: flex; flex-direction: column; }
.tp-kanban--deals .tp-kanban__col-cards { flex: 1 1 auto; }
.tp-kanban__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  padding: 0 4px;
}
.tp-kanban__col-cards { display: flex; flex-direction: column; gap: 8px; }
.tp-kanban__card {
  display: block;
  background: var(--tp-paper);
  border: var(--tp-border-soft-1);
  border-radius: var(--tp-radius-sm);
  padding: 10px;
  min-height: 96px;
  text-decoration: none;
  color: inherit;
  transition: border-color var(--tp-duration-fast) var(--tp-ease),
              box-shadow var(--tp-duration-fast) var(--tp-ease);
}
.tp-kanban__card:hover {
  border-color: var(--tp-navy-300);
  box-shadow: var(--tp-shadow-sm);
}
/* Per spec 2.2: parcel 10px mono fg-faint, address 14px Merriweather Bold w/ ellipsis,
   meta 11px fg-subtle, metric terra bold (per 2.3 — operator's win, not a pass/fail). */
.tp-kanban__parcel {
  font-size: 10px;
  color: var(--tp-fg-faint);
  font-family: var(--tp-font-mono);
  margin-bottom: 2px;
}
.tp-kanban__address {
  font-family: var(--tp-font-display);
  font-size: 14px;
  font-weight: 700;
  color: var(--tp-navy);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tp-kanban__meta { font-size: 11px; color: var(--tp-fg-subtle); margin-top: 4px; font-variant-numeric: tabular-nums; }
.tp-kanban__metric { font-size: 11px; color: var(--tp-terra); font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.tp-kanban__deadline { font-size: 11px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.tp-kanban__deadline--urgent { color: var(--tp-negative); font-weight: 600; }
.tp-kanban__empty { font-size: 11px; color: var(--tp-fg-faint); padding: 8px 4px; text-align: center; }
/* Action pill on kanban cards — 10px tracked, ~18px tall (per spec 2.2). */
.tp-kanban__card .tp-pill {
  font-size: 10px;
  letter-spacing: 0.1em;
  padding: 3px 8px;
  line-height: 1.2;
}

/* ── Lookup page ─────────────────────────────────────────────────── */
/* Per spec 3.2: 32px Merriweather Bold navy. Operator-screen page H1 ramp
   (vs marketing tp-h1 which is bigger). */
.tp-page-h1 {
  font-family: var(--tp-font-display);
  font-size: 32px;
  font-weight: 700;
  color: var(--tp-navy);
  letter-spacing: -0.01em;
  line-height: 1.15;
  margin: 0;
}

/* Quick-filter chips above the search input (per spec 3.1). */
.tp-quick-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.tp-quick-filter {
  font-family: var(--tp-font-body);
  font-size: 11px;
  font-weight: 600;
  color: var(--tp-fg-muted);
  background: var(--tp-bg-soft);
  border: var(--tp-border-thin);
  border-radius: 12px;
  padding: 5px 12px;
  text-decoration: none;
  transition: background var(--tp-duration-fast) var(--tp-ease),
              color var(--tp-duration-fast) var(--tp-ease),
              border-color var(--tp-duration-fast) var(--tp-ease);
}
.tp-quick-filter:hover {
  color: var(--tp-navy);
  background: var(--tp-paper);
  border-color: var(--tp-border);
}

/* Idle state: recent lookups + saved searches (per spec 3.1). */
.tp-lookup-idle {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 18px;
  margin-top: 24px;
}
.tp-lookup-idle__main { min-width: 0; }
.tp-lookup-idle__side { min-width: 0; }
.tp-lookup-idle__main .tp-eyebrow,
.tp-lookup-idle__side .tp-eyebrow { margin-bottom: 8px; display: inline-block; }

.tp-saved-list { list-style: none; padding: 0; margin: 0; }
.tp-saved-list__item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 0;
  border-bottom: var(--tp-border-soft-1);
}
.tp-saved-list__item:last-child { border-bottom: none; }
.tp-saved-list__name {
  font-size: 13px;
  font-weight: 600;
  color: var(--tp-navy);
  text-decoration: none;
}
.tp-saved-list__name:hover { text-decoration: underline; }
.tp-saved-list__matches {
  font-size: 11px;
  color: var(--tp-fg-subtle);
  font-variant-numeric: tabular-nums;
}
.tp-saved-list__matches--new { color: var(--tp-terra); font-weight: 600; }

@media (max-width: 880px) {
  .tp-lookup-idle { grid-template-columns: 1fr; }
}

/* ── Lookup table ────────────────────────────────────────────────── */
.tp-lookup-form {
  display: flex;
  gap: 8px;
  margin-bottom: var(--tp-space-5);
  max-width: 720px;
}
.tp-lookup-form .tp-autocomplete { flex: 1; position: relative; }
.tp-lookup-form .tp-input { width: 100%; }

.tp-autocomplete__menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 4px 0;
  list-style: none;
  background: var(--tp-paper);
  border: var(--tp-border-thin);
  border-radius: var(--tp-radius-sm);
  box-shadow: var(--tp-shadow-md);
  z-index: 40;
  max-height: 320px;
  overflow-y: auto;
}
.tp-autocomplete__item {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  color: var(--tp-fg);
  display: flex;
  align-items: center;
  gap: 6px;
}
.tp-autocomplete__item:hover,
.tp-autocomplete__item.is-active {
  background: var(--tp-bg-soft);
}
.tp-autocomplete__primary {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Banners — per spec 15.1: error variant gets ⚠ icon + dismissible × on
   right; uses --tp-negative-bg/border/sm-radius. The ⚠ icon and × button
   are rendered by the banner_error macro; dismissal is Alpine-driven so
   a closed banner stays closed for the lifetime of the page. */
.tp-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border-radius: var(--tp-radius-sm);
  padding: 12px 14px;
  margin-bottom: var(--tp-space-5);
  font-size: 13px;
  line-height: 1.45;
}
.tp-banner__icon {
  flex-shrink: 0;
  font-weight: 700;
  line-height: 1.2;
  font-size: 14px;
}
.tp-banner__body { flex: 1; min-width: 0; }
.tp-banner__close {
  flex-shrink: 0;
  background: transparent;
  border: none;
  cursor: pointer;
  color: inherit;
  opacity: 0.6;
  font-size: 16px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 3px;
  transition: opacity var(--tp-duration-fast) var(--tp-ease),
              background var(--tp-duration-fast) var(--tp-ease);
}
.tp-banner__close:hover { opacity: 1; background: rgba(0,0,0,0.06); }
.tp-banner__close:focus-visible {
  outline: 2px solid var(--tp-focus-ring);
  outline-offset: 2px;
  opacity: 1;
}
.tp-banner--error { background: var(--tp-negative-bg); border: 1px solid var(--tp-negative); color: var(--tp-negative); }
.tp-banner--warn  { background: var(--tp-warning-bg); border: 1px solid var(--tp-warning-border); color: var(--tp-warning-fg); }
.tp-banner--info  { background: var(--tp-bg-fill);    border: var(--tp-border-thin); color: var(--tp-fg); }

/* ── Layout helpers ──────────────────────────────────────────────── */
.tp-row  { display: flex; align-items: center; gap: 12px; }
.tp-col  { display: flex; flex-direction: column; gap: 12px; }
.tp-grow { flex: 1; min-width: 0; }
.tp-stack-4  { display: flex; flex-direction: column; gap: var(--tp-space-1); }
.tp-stack-8  { display: flex; flex-direction: column; gap: var(--tp-space-2); }
.tp-stack-12 { display: flex; flex-direction: column; gap: var(--tp-space-3); }
.tp-stack-16 { display: flex; flex-direction: column; gap: var(--tp-space-4); }
.tp-stack-24 { display: flex; flex-direction: column; gap: var(--tp-space-6); }

/* Right-rail divider strip used between assistant/audit/comms */
.tp-divider-y {
  display: inline-block;
  width: 1px;
  height: 22px;
  background: var(--tp-border);
  margin: 0 4px;
}

/* hide the default <details> arrow on collapsibles */
details > summary { list-style: none; }
details > summary::-webkit-details-marker { display: none; }

.tp-pill--risk { background: #f59e0b; color: #fff; font-weight: 700; }

.tp-checklist__item--risk { background: #fffbeb; border-left: 2px solid #f59e0b; padding-left: 6px; }

/* ── Sprint 13: Data Quality Flags Panel ─────────────────────────── */
.tp-dq-panel {
  border: 1px solid var(--tp-border);
  border-radius: 6px;
  overflow: hidden;
  font-size: 12px;
}
.tp-dq-panel__header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--tp-surface-2);
  border-bottom: 1px solid var(--tp-border);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--tp-muted);
}
.tp-dq-panel__count {
  margin-left: auto;
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
}
.tp-dq-panel__count--error { background: var(--tp-danger); color: #fff; }
.tp-dq-panel__count--warn  { background: var(--tp-warning); color: #000; }
.tp-dq-flag {
  padding: 8px 10px;
  border-bottom: 1px solid var(--tp-border);
}
.tp-dq-flag:last-child { border-bottom: none; }
.tp-dq-flag--error { background: #fff5f5; }
.tp-dq-flag--warning { background: #fffbf0; }
.tp-dq-flag--info { background: #f0f7ff; }
.tp-dq-flag__row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 3px;
}
.tp-dq-badge {
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.05em;
}
.tp-dq-badge--error   { background: var(--tp-danger); color: #fff; }
.tp-dq-badge--warning { background: var(--tp-warning); color: #000; }
.tp-dq-badge--info    { background: var(--tp-info, #3b82f6); color: #fff; }
.tp-dq-flag__field {
  font-size: 10px;
  font-family: monospace;
  color: var(--tp-muted);
}
.tp-dq-flag__msg {
  margin: 0;
  font-size: 11px;
  color: var(--tp-text);
  line-height: 1.4;
}
.tp-dq-override { margin-top: 6px; }
.tp-dq-override__toggle {
  font-size: 11px;
  color: var(--tp-accent);
  cursor: pointer;
  user-select: none;
}
.tp-dq-override__form { margin-top: 6px; }
.tp-dq-override__row {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  align-items: center;
}
.tp-input--sm {
  padding: 3px 6px;
  font-size: 11px;
  height: 26px;
}
.tp-btn--xs {
  padding: 3px 8px;
  font-size: 11px;
  height: 26px;
}

/* ─────────────────────────────────────────────────────────────────────
   Signal / Learning shared styles (L22 dashboard tab + supporting
   widgets). Lives here rather than in a per-template <style> block so
   the Patterns tab can render the tab strip too — without this, the
   tabs collapse to plain inline links and become invisible.
   ───────────────────────────────────────────────────────────────────── */

.tp-sig-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--tp-border);
  margin: 1rem 0 1rem;
}
.tp-sig-tab {
  padding: 0.65rem 1.1rem;
  color: var(--tp-fg-muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: -1px;
}
.tp-sig-tab:hover { color: var(--tp-navy); }
.tp-sig-tab.is-active {
  color: var(--tp-navy);
  border-bottom-color: var(--tp-terra);
}

.tp-sig-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.tp-sig-table th, .tp-sig-table td {
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--tp-border-soft);
}
.tp-sig-table th { font-weight: 600; color: var(--tp-fg-muted); }
.tp-sig-table .tp-num { text-align: right; font-variant-numeric: tabular-nums; }

.tp-sig-feed { list-style: none; padding: 0; margin: 0; }
.tp-sig-feed__item { padding: 0.6rem 0; border-bottom: 1px solid var(--tp-border-soft); }
.tp-sig-feed__item:last-child { border-bottom: none; }
.tp-sig-feed__meta { font-size: 0.85rem; display: flex; gap: 0.5rem; align-items: center; }
.tp-sig-feed__summary { margin: 0.25rem 0; }
.tp-sig-feed__delta { font-size: 0.85rem; }

.tp-mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.tp-fg-subtle { color: var(--tp-fg-subtle); }

.tp-assessor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.75rem;
  margin-top: 0.5rem;
}
.tp-assessor-card {
  border: 1px solid var(--tp-border-soft);
  border-radius: 6px;
  padding: 0.75rem;
  background: var(--tp-paper);
}
.tp-assessor-card__county {
  font-weight: 600;
  color: var(--tp-navy);
  text-transform: capitalize;
  margin-bottom: 0.5rem;
}
.tp-assessor-card__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.2rem 0;
  font-size: 0.9rem;
}

/* Short helper paragraph under each section title — frames what the
   panel is showing for a first-time reader. */
.tp-sig-section-lead {
  font-size: 0.88rem;
  color: var(--tp-fg-muted);
  margin: -0.5rem 0 0.85rem 0;
  max-width: 720px;
  line-height: 1.5;
}

/* Two-column comp-loop snapshot: exclusions on the left, swap-ins on
   the right. Collapses to one column on narrow viewports. */
.tp-comp-loop-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-top: 0.5rem;
}
@media (max-width: 720px) {
  .tp-comp-loop-grid { grid-template-columns: 1fr; }
}

/* Second-line description on the Loops-at-a-glance table — sits below
   the loop name and pill. */
.tp-loop-desc {
  font-size: 0.82rem;
  color: var(--tp-fg-subtle);
  margin-top: 0.15rem;
  line-height: 1.45;
  max-width: 520px;
}

/* ── Deals pipeline (/deals) ─────────────────────────────────────── */
/* Six deal-stage columns (vs the 7-column case kanban). minmax(0,1fr)
   like the case board so 1280–1366px laptops fit without a horizontal
   scrollbar; below 900px the wrapper scrolls instead of crushing cards. */
.tp-kanban--deals { grid-template-columns: repeat(6, minmax(0, 1fr)); min-width: 900px; }
.tp-kanban-scroll { overflow-x: auto; }

.tp-deal-card {
  width: 100%; text-align: left; cursor: pointer;
  font-family: var(--tp-font-body); font-size: 14px;
  border-left: 3px solid var(--tp-border);
}
#deals-page.is-editing .tp-deal-card { cursor: grab; }
.tp-deal-card--urgent { border-left-color: var(--tp-terra); }
.tp-deal-card__tags { margin-top: 6px; display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.tp-deal-card__tags .tp-pill { font-size: 9px; padding: 2px 6px; letter-spacing: 0.08em; }
.tp-kanban--deals .sortable-ghost { opacity: 0.4; }

/* Edit mode gating: structural changes hidden until the toggle is on. */
#deals-page:not(.is-editing) .tp-edit-only { display: none !important; }
#deals-page.is-editing .tp-view-only { display: none !important; }

/* The corner chips live in one strip, laid out by flex rather than by
   guessing each other's widths. It clears the floating feedback button
   (bottom/right 20px) by starting further left. */
.tp-deal-hud {
  position: fixed; right: 76px; bottom: 20px; z-index: 40;
  display: flex; align-items: flex-end; gap: 10px;
  max-width: calc(100vw - 96px); flex-wrap: wrap; justify-content: flex-end;
}
.tp-boe {
  background: var(--tp-paper); border: var(--tp-border-thin); border-radius: var(--tp-radius-sm);
  box-shadow: var(--tp-shadow-md); padding: 10px 14px; min-width: 172px;
}
.tp-boe__days {
  font-family: var(--tp-font-display); font-size: 22px; font-weight: 700;
  color: var(--tp-terra); font-variant-numeric: tabular-nums; line-height: 1.2;
}
.tp-boe__date { font-size: 11px; color: var(--tp-fg-muted); font-variant-numeric: tabular-nums; }

/* Deal windows are centred dialogs, not a right-hand strip — there's more
   room for the form, and it reads as the focus of the screen. */
.tp-deal-modal-backdrop {
  position: fixed; inset: 0; background: rgba(26, 39, 68, 0.35); z-index: 60;
}
.tp-deal-modal {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  /* Narrow enough to read in one eyeful and never wider than the window;
     overflow-x guards against any child forcing a sideways scroll. */
  width: min(660px, calc(100vw - 32px)); max-height: calc(100vh - 56px);
  overflow-y: auto; overflow-x: hidden; z-index: 61;
  background: var(--tp-paper); border: var(--tp-border-thin);
  border-radius: var(--tp-radius-md); box-shadow: var(--tp-shadow-lg);
  padding: 22px 26px 28px;
}
@media (prefers-reduced-motion: no-preference) {
  .tp-deal-modal { animation: tp-deal-modal-in var(--tp-duration) var(--tp-ease); }
  @keyframes tp-deal-modal-in {
    from { opacity: 0; transform: translate(-50%, calc(-50% + 8px)); }
    to   { opacity: 1; transform: translate(-50%, -50%); }
  }
}
.tp-deal-drawer__close {
  position: absolute; top: 14px; right: 16px; background: none; border: none; cursor: pointer;
  color: var(--tp-fg-subtle); font-size: 20px; line-height: 1; padding: 6px; border-radius: 3px;
}
.tp-deal-drawer__close:hover { background: var(--tp-bg-fill); color: var(--tp-navy); }
.tp-deal-drawer__title {
  font-family: var(--tp-font-display); font-size: 24px; font-weight: 700;
  color: var(--tp-navy); margin: 4px 0 2px; letter-spacing: -0.01em;
}
.tp-deal-drawer__section { margin-top: 22px; }
.tp-deal-drawer__section > .tp-eyebrow { display: block; margin-bottom: 8px; }
.tp-deal-drawer__footer {
  margin-top: 28px; padding-top: 14px; border-top: var(--tp-border-soft-1);
  display: flex; align-items: center; gap: 8px;
}

.tp-deal-contact { display: grid; grid-template-columns: 84px 1fr; gap: 3px 12px; font-size: 13px; margin: 0; }
.tp-deal-contact dt { color: var(--tp-fg-subtle); margin: 0; }
.tp-deal-contact dd { margin: 0; color: var(--tp-fg); overflow-wrap: anywhere; }
.tp-deal-meeting-link { font-size: 12.5px; font-weight: 600; }

.tp-deal-note {
  background: var(--tp-cream-100); border: 1px solid var(--tp-cream-200);
  border-radius: var(--tp-radius-sm); padding: 8px 10px; margin-bottom: 6px;
  font-size: 13px; color: var(--tp-ink); white-space: pre-wrap;
}
.tp-deal-note__meta { font-size: 11px; color: var(--tp-stone); margin-top: 3px; }
.tp-deal-note-form { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }

.tp-deal-parcel-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 10px; border: var(--tp-border-soft-1); border-radius: var(--tp-radius-sm);
  background: var(--tp-bg-soft); margin-bottom: 6px;
}
.tp-deal-parcel-row__addr { font-family: var(--tp-font-display); font-weight: 700; font-size: 13px; color: var(--tp-navy); }
.tp-deal-parcel-row__meta { font-size: 11px; color: var(--tp-fg-subtle); font-variant-numeric: tabular-nums; }

.tp-deal-doc-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border-bottom: var(--tp-border-soft-1); font-size: 13px;
}
.tp-deal-doc-row:last-of-type { border-bottom: none; }
.tp-deal-doc-row__icon {
  width: 30px; height: 30px; border-radius: 3px; background: var(--tp-cream-100);
  border: 1px solid var(--tp-cream-200); color: var(--tp-stone); flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 700; letter-spacing: 0.04em;
}
.tp-deal-doc-row__name { font-weight: 600; color: var(--tp-navy); overflow-wrap: anywhere; }
.tp-deal-doc-row__meta { font-size: 11px; color: var(--tp-fg-subtle); }
.tp-deal-upload { margin-top: 10px; }

.tp-deal-activity { list-style: none; margin: 0; padding: 0; }
.tp-deal-activity li {
  position: relative; padding: 0 0 14px 18px; font-size: 12.5px; color: var(--tp-fg-muted);
  border-left: 1px solid var(--tp-border); margin-left: 4px;
}
.tp-deal-activity li::before {
  content: ''; position: absolute; left: -4.5px; top: 5px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--tp-navy-300);
}
.tp-deal-activity li:first-child::before { background: var(--tp-terra); }
.tp-deal-activity b { color: var(--tp-navy); font-weight: 600; }
.tp-deal-activity__when { color: var(--tp-fg-faint); font-size: 11px; display: block; }

.tp-deal-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tp-deal-field { display: flex; flex-direction: column; gap: 4px; }
.tp-deal-field--wide { grid-column: 1 / -1; }
.tp-deal-field > label {
  font-size: 10px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--tp-fg-subtle);
}

/* One parcel per block, five fields across two tight rows: address + parcel
   number, then packet and the two years. Four fields on a single line left
   every box too narrow to read; a field per line made the form enormous. */
.tp-deal-parcel-edit {
  position: relative;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px 10px;
  padding: 10px 30px 10px 10px;
  margin-bottom: 8px;
  background: var(--tp-bg-soft);
  border: var(--tp-border-soft-1);
  border-radius: var(--tp-radius-sm);
}
.tp-deal-pf { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.tp-deal-pf--addr { grid-column: span 4; }
.tp-deal-pf--no { grid-column: span 2; }
.tp-deal-pf--packet, .tp-deal-pf--prior, .tp-deal-pf--current { grid-column: span 2; }
.tp-deal-pf > label {
  font-size: 9px; font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--tp-fg-subtle);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tp-deal-pf__hint {
  font-weight: 400; letter-spacing: 0; text-transform: none;
  color: var(--tp-fg-faint);
}
.tp-deal-parcel-edit .tp-input {
  width: 100%; font-size: 12.5px; padding: 6px 8px;
  background: var(--tp-paper);
}
.tp-deal-parcel-edit__rm {
  position: absolute; top: 8px; right: 6px;
  background: none; border: none; cursor: pointer; color: var(--tp-fg-faint);
  font-size: 15px; line-height: 1; padding: 3px 5px; border-radius: 3px;
}
.tp-deal-parcel-edit__rm:hover { color: var(--tp-negative); background: var(--tp-negative-bg); }
.tp-deal-money { font-variant-numeric: tabular-nums; }
@media (max-width: 620px) {
  .tp-deal-parcel-edit { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tp-deal-pf--addr { grid-column: span 2; }
  .tp-deal-pf--no, .tp-deal-pf--packet,
  .tp-deal-pf--prior, .tp-deal-pf--current { grid-column: span 1; }
}
.tp-deal-parcel-edit__rm:hover { color: var(--tp-negative); background: var(--tp-negative-bg); }

.tp-deal-archive-row {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 10px 12px; border: var(--tp-border-soft-1); border-radius: var(--tp-radius-sm);
  background: var(--tp-bg-soft); margin-bottom: 8px;
}
.tp-deal-archive-row__client {
  background: none; border: none; padding: 0; cursor: pointer; text-align: left;
  font-family: var(--tp-font-display); font-size: 14px; font-weight: 700; color: var(--tp-navy);
}
.tp-deal-archive-row__client:hover { color: var(--tp-terra); }

/* Narrow screens: single-column form, two-row parcel editor. */
@media (max-width: 560px) {
  .tp-deal-form-grid { grid-template-columns: 1fr; }
  .tp-deal-field--wide { grid-column: auto; }
  .tp-deal-parcel-edit { grid-template-columns: 1fr 1fr; }
}

.tp-deals-flash {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 80;
  background: var(--tp-warning-bg); color: var(--tp-warning-fg);
  border: 1px solid var(--tp-warning-border); border-radius: var(--tp-radius-sm);
  box-shadow: var(--tp-shadow-md); padding: 10px 16px; font-size: 13px; font-weight: 600;
  max-width: min(90vw, 480px);
}

/* ── Deals: stage-advance button ─────────────────────────────────── */
/* Drag is optional — every card can be advanced with one click, which is
   also the only path available from the keyboard. */
.tp-deal-card-wrap { display: flex; flex-direction: column; }
.tp-deal-advance {
  align-self: stretch;
  margin-top: -1px;
  font-family: var(--tp-font-body);
  font-size: 10px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--tp-fg-subtle);
  background: var(--tp-paper);
  border: var(--tp-border-soft-1); border-top: none;
  border-radius: 0 0 var(--tp-radius-sm) var(--tp-radius-sm);
  padding: 5px 8px; cursor: pointer; text-align: center;
  transition: background var(--tp-duration-fast) var(--tp-ease),
              color var(--tp-duration-fast) var(--tp-ease);
}
.tp-deal-advance:hover { background: var(--tp-terra-100); color: var(--tp-terra); }
.tp-deal-advance:disabled { opacity: 0.5; cursor: progress; }
.tp-deal-card-wrap:has(.tp-deal-advance) .tp-deal-card { border-radius: var(--tp-radius-sm) var(--tp-radius-sm) 0 0; }
.tp-deal-move-row .tp-deal-advance:first-child { border-bottom-right-radius: 0; }
.tp-deal-move-row .tp-deal-advance:last-child { border-bottom-left-radius: 0; }
.tp-deal-move-row .tp-deal-advance + .tp-deal-advance { border-left: var(--tp-border-soft-1); }
.tp-deal-group .tp-deal-move-row { padding: 0 6px 8px 6px; }
.tp-deal-group .tp-deal-move-row .tp-deal-advance {
  border: var(--tp-border-soft-1); border-radius: var(--tp-radius-sm);
}

/* ── Deals: file picker ──────────────────────────────────────────── */
/* The native control is OS chrome in an OS font — hidden, driven by a label
   that uses the app's own button vocabulary. */
.tp-deal-filepick {
  display: flex; align-items: center; gap: 10px;
  border: var(--tp-border-thin); border-radius: var(--tp-radius-sm);
  background: var(--tp-paper); padding: 4px 10px 4px 4px; cursor: pointer;
  min-height: 36px;
}
.tp-deal-filepick:hover { border-color: var(--tp-navy-300); }
.tp-deal-filepick input[type="file"] {
  position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none;
}
.tp-deal-filepick input[type="file"]:focus-visible + .tp-deal-filepick__btn {
  outline: 2px solid var(--tp-focus-ring); outline-offset: 2px;
}
.tp-deal-filepick__btn {
  flex-shrink: 0; background: var(--tp-bg-fill); color: var(--tp-navy);
  border: 1px solid var(--tp-border); border-radius: 3px;
  font-size: 12px; font-weight: 600; padding: 5px 12px; line-height: 1;
}
.tp-deal-filepick:hover .tp-deal-filepick__btn { background: var(--tp-bg-soft); }
.tp-deal-filepick__name {
  font-size: 12.5px; color: var(--tp-fg-subtle);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tp-deal-upload__row { display: flex; gap: 8px; margin-top: 6px; }
.tp-deal-upload__row .tp-input { flex: 1; min-width: 0; min-height: 36px; }
.tp-deal-upload__row .tp-btn { min-height: 36px; flex-shrink: 0; }

/* Empty columns should read as intentionally empty, not still loading. */
.tp-kanban--deals .tp-kanban__empty {
  padding: 28px 4px; font-style: italic;
}

/* Field labels adopt the app's small-label spec (10px / 0.14em), the same
   one the Prospects table headers use — rather than inventing a third. */
.tp-deal-field > label { letter-spacing: 0.14em; }

/* ── Deals: fee estimate ─────────────────────────────────────────── */
/* Sits beside the BOE chip; both clear the floating feedback button. */
.tp-deal-fee {
  background: var(--tp-paper); border: var(--tp-border-thin);
  border-radius: var(--tp-radius-sm); box-shadow: var(--tp-shadow-md);
  padding: 10px 14px; min-width: 176px;
}
.tp-deal-fee__amount {
  font-family: var(--tp-font-display); font-size: 22px; font-weight: 700;
  color: var(--tp-navy); font-variant-numeric: tabular-nums; line-height: 1.2;
}
.tp-deal-fee__note { font-size: 11px; color: var(--tp-fg-muted); font-variant-numeric: tabular-nums; }
.tp-deal-fee__missing { color: var(--tp-warning-fg); }
.tp-deal-parcel-total {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-top: 10px; padding-top: 10px; border-top: var(--tp-border-thin);
}
.tp-deal-parcel-total__amount {
  font-family: var(--tp-font-display); font-size: 18px; font-weight: 700;
  color: var(--tp-navy); font-variant-numeric: tabular-nums;
}

/* ── Deals: stacked client groups ────────────────────────────────── */
/* One owner's parcels in a column read as one card until opened. */
/* ── Deals: portfolio card ───────────────────────────────────────── */
/* A client with several parcels in one column. Collapsed it answers "what
   is this worth"; opened it becomes the work. One border per card, and no
   nested containers — sections are a label and a rail. */
.tp-pf {
  background: var(--tp-paper);
  border: var(--tp-border-thin);
  border-left: 3px solid var(--tp-terra);
  border-radius: var(--tp-radius-sm);
  box-shadow: var(--tp-shadow-sm);
  transition: box-shadow var(--tp-duration-fast) var(--tp-ease);
}
.tp-pf:hover { box-shadow: var(--tp-shadow-md); }
#deals-page.is-editing .tp-pf { cursor: grab; }
.tp-pf__head { display: flex; align-items: center; gap: 7px; padding: 11px 12px 0; }
.tp-pf__toggle {
  background: none; border: none; cursor: pointer; flex-shrink: 0;
  padding: 3px 4px; border-radius: 3px; line-height: 1;
}
.tp-pf__toggle:hover { background: var(--tp-border-soft); }
.tp-pf__chev {
  display: inline-block; font-size: 9px; color: var(--tp-fg-faint);
  transition: transform var(--tp-duration-fast) var(--tp-ease);
}
.tp-pf.is-open .tp-pf__chev { transform: rotate(90deg); color: var(--tp-terra); }
.tp-pf__name {
  background: none; border: none; padding: 0; cursor: pointer; text-align: left;
  font-family: var(--tp-font-display); font-size: 14.5px; font-weight: 700;
  color: var(--tp-navy); line-height: 1.2; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tp-pf__name:hover { color: var(--tp-terra); }
.tp-pf__count {
  margin-left: auto; flex-shrink: 0; font-size: 10px; font-weight: 700;
  color: var(--tp-terra); background: var(--tp-terra-100);
  border: 1px solid var(--tp-terra-200); border-radius: var(--tp-radius-pill);
  padding: 1px 7px; font-variant-numeric: tabular-nums;
}
/* Figures: the headline answer, kept whether open or closed. */
.tp-pf__figs {
  display: flex; margin: 9px 12px 0; padding: 8px 0;
  border-top: var(--tp-border-soft-1); border-bottom: var(--tp-border-soft-1);
}
.tp-pf-fig { flex: 1; min-width: 0; padding: 0 8px; border-left: var(--tp-border-soft-1); }
.tp-pf-fig:first-child { border-left: none; padding-left: 0; }
.tp-pf-fig__v {
  display: block; font-family: var(--tp-font-display); font-size: 14px; font-weight: 700;
  color: var(--tp-navy); font-variant-numeric: tabular-nums; line-height: 1.15;
  overflow: hidden; text-overflow: ellipsis;
}
.tp-pf-fig__l {
  display: block; font-size: 8.5px; font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--tp-fg-faint); margin-top: 2px;
}
.tp-pf-fig--fee .tp-pf-fig__v { color: var(--tp-terra); }
.tp-pf-fig--warn .tp-pf-fig__v { color: var(--tp-warning); }
/* Collapsed: a quiet, scannable address list. */
.tp-pf__list { list-style: none; margin: 0; padding: 8px 12px 0; }
.tp-pf-row { display: flex; align-items: baseline; gap: 7px; padding: 3px 0; font-size: 12px; }
.tp-pf-row__addr {
  flex: 1; min-width: 0; color: var(--tp-fg-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tp-pf-row__val { flex-shrink: 0; color: var(--tp-fg-subtle); font-variant-numeric: tabular-nums; }
.tp-pf-row--more { color: var(--tp-fg-faint); font-style: italic; }
.tp-pf-chip {
  flex-shrink: 0; font-size: 8.5px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--tp-stone);
  background: var(--tp-cream-100); border: 1px solid var(--tp-cream-200);
  border-radius: 3px; padding: 1px 5px;
  max-width: 84px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tp-pf__foot {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin: 8px 12px 0; padding: 8px 0 10px; border-top: var(--tp-border-soft-1);
}
.tp-pf__open {
  font-size: 9.5px; font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--tp-terra);
}
/* Open / closed swap. */
.tp-pf__body { display: none; flex-direction: column; gap: 16px; padding: 12px 12px 2px; }
.tp-pf.is-open .tp-pf__body { display: flex; }
.tp-pf.is-open .tp-pf__list,
.tp-pf.is-open .tp-pf__foot { display: none; }
.tp-pf:not(.is-open) .tp-pf-actions--foot { display: none; }
/* Sections: a label and a rail, never another box. */
.tp-pf-sec { display: flex; flex-direction: column; gap: 6px; }
.tp-pf-sec--packet {
  border-left: 2px solid var(--tp-terra-200); padding-left: 10px; margin-left: 1px;
}
.tp-pf-sec__head { display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap; }
.tp-pf-sec__label {
  font-size: 9.5px; font-weight: 700; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--tp-terra);
}
.tp-pf-sec__note { font-size: 10.5px; color: var(--tp-stone); }
/* One border per parcel. */
.tp-pf-card {
  display: block; width: 100%; text-align: left; cursor: pointer;
  background: var(--tp-paper); border: var(--tp-border-soft-1);
  border-radius: var(--tp-radius-sm); padding: 9px 10px;
  transition: border-color var(--tp-duration-fast) var(--tp-ease),
              box-shadow var(--tp-duration-fast) var(--tp-ease);
}
.tp-pf-card:hover { border-color: var(--tp-navy-300); box-shadow: var(--tp-shadow-sm); }
.tp-pf-card__id { font-family: var(--tp-font-mono); font-size: 9.5px; color: var(--tp-fg-faint); }
.tp-pf-card__addr {
  font-family: var(--tp-font-display); font-size: 13px; font-weight: 700;
  color: var(--tp-navy); line-height: 1.25; margin-top: 1px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tp-pf-card__meta {
  display: flex; justify-content: space-between; gap: 8px; margin-top: 4px;
  font-size: 11px; color: var(--tp-fg-subtle); font-variant-numeric: tabular-nums;
}
.tp-pf-card__fee { color: var(--tp-terra); font-weight: 700; flex-shrink: 0; }
/* Actions are a flat strip, never a row of bordered blocks. */
.tp-pf-actions {
  display: flex; gap: 1px; background: var(--tp-border-soft);
  border-radius: 3px; overflow: hidden;
}
.tp-pf-actions:empty { display: none; }
.tp-pf-act {
  flex: 1; background: var(--tp-paper); border: none; cursor: pointer;
  font-family: var(--tp-font-body); font-size: 9.5px; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--tp-fg-subtle);
  padding: 7px 6px; text-align: center;
  transition: background var(--tp-duration-fast) var(--tp-ease),
              color var(--tp-duration-fast) var(--tp-ease);
}
.tp-pf-act:hover { background: var(--tp-terra-100); color: var(--tp-terra); }
.tp-pf-act--back:hover { background: var(--tp-bg-fill); color: var(--tp-navy); }
.tp-pf-act:disabled { opacity: 0.5; cursor: progress; }
.tp-pf-actions--foot { margin: 12px; }

/* A packet is a bundle inside the group — filed together, moves together. */
.tp-deal-packet {
  border: 1px dashed var(--tp-border); border-radius: var(--tp-radius-sm);
  background: var(--tp-cream-100); padding: 6px;
  display: flex; flex-direction: column; gap: 6px;
}
.tp-deal-packet__head {
  display: flex; align-items: center; justify-content: space-between; padding: 0 2px;
}
.tp-deal-packet__head .tp-eyebrow { font-size: 9px; letter-spacing: 0.12em; color: var(--tp-stone); }
.tp-deal-packet__foot {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  padding: 0 2px;
}
.tp-deal-packet__foot .tp-deal-advance {
  margin-top: 0; border: var(--tp-border-soft-1); border-radius: var(--tp-radius-sm);
  align-self: auto; flex: 1;
}
