/* ═══════════════════════════════════════════════════════════════════════
   Kinfold / EstateOS — base.css (owner: the foundation agent)
   Tokens and the generic components, 30 October 2026.

   The EstateOS look (Kamau's other product; its tokens.css and app.css are
   the source) layered over the Apple theme of kwetu.css. Every rule:
     - sits inside the one `@media screen` block below, so print and the PDF
       export (WeasyPrint evaluates media types) match nothing here;
     - starts `html.theme-apple.theme-estate`, (0,2,1), which outranks the
       Apple section's `html.theme-apple` (0,1,1); `!important` only where
       the Apple rule it replaces uses it;
     - that changes geometry or type carries `:not([data-report-page] *)`:
       a report page's content column is marked `data-report-page` by
       base.html (Kamau, 30 October 2026: "The reports inner layout should
       not be changed") and keeps its current screen layout — only colours
       reach it, through the tokens.

   Light only (Kamau's decision): the Apple dark-mode tokens are redefined
   inside the same prefers-color-scheme query, so a dark OS renders light.

   Tokens the Apple rules read for SIZE (--fs-body, --fs-label, --fs-h4,
   --fs-stat, --radius-card, --radius-ctl, --radius-pill) are deliberately
   NOT redefined: a report page's text metrics and card radii come from
   them. EstateOS sizes use the new names below.

   Component classes and selectors the page agents can build on (all under
   html.theme-apple.theme-estate, all off report pages):
     tokens      --oxblood --oxblood-deep --oxblood-tint --charcoal
                 --charcoal-2 --on-dark --on-dark-muted --ink --muted
                 --paper --paper-2 --surface --line --line-strong
                 --placeholder --hover --hover-line --ok --ok-tint --warn
                 --warn-tint --danger --danger-tint --amber --avatar-dark
                 --shadow --shadow-panel --ring --font --font-display
                 --radius-sm (6) --radius (8) --radius-lg (12)
                 --content-max (1120px) --nav-width (288px) --tabbar-height
     utilities   .num / .tabular (tabular numbers), .eyebrow (11px uppercase
                 label), .text-muted, .text-primary/.text-success/
                 .text-warning/.text-danger, .bg-light, .bg-white
     header      .page-header (hairline), .page-header h4 (32px/700),
                 .page-header p / .lead (muted 16px)
     panels      .card (12px radius, line border, shadow-panel),
                 .card-header (17px/600), .card-body, .card-footer
     tables      .table (14px, paper-2 header 13px/600 muted, hairlines,
                 row hover --hover), .table-sm, .table-hover, .table-light
     pills       .badge (dotted status pill); .badge.bg-success / .bg-warning
                 / .bg-danger / .bg-secondary map to ok / warn / danger /
                 muted; .bg-info / .bg-primary are oxblood count pills;
                 .badge.estate-count (no dot, charcoal)
     buttons     .btn (44px, radius 6, 15px/600); .btn-primary / .btn-kwetu
                 / .btn-success = oxblood; .btn-outline-* / .btn-secondary /
                 .btn-light = quiet; .btn-outline-danger = quiet-danger;
                 .btn-danger / .btn-hard-delete = solid danger; .btn-sm 40px;
                 .btn-link
     forms       .form-control / .form-select (48px, line-strong, oxblood
                 ring), -sm 36px, .form-label, .form-text, .form-check-input
     alerts      .alert (left-edge), .alert-success/-warning/-danger/-info
     tabs        .nav-tabs (2px oxblood underline), .nav-tabs .nav-link,
                 .nav-tabs .badge (count pill)
     chips       .member-scopes / .member-scope / .member-scope-count
                 (members_scopes inclusion tag; segmented 4-up on phones)
     pager       .pagination / .page-link / .page-item.active
     bars        .progress (6px) / .progress-bar (oxblood; .bg-* status)
     lists       .list-group / .list-group-item / .list-group-item-action
     menus       .dropdown-menu / .dropdown-item / .dropdown-divider
     modals      .modal-content / .modal-header / .modal-footer / .modal-title
     accordion   .accordion-item / .accordion-button
     crumbs      .breadcrumb / .breadcrumb-item
     avatars     .member-avatar / .avatar-male / .avatar-female
   ═══════════════════════════════════════════════════════════════════════ */
@media screen {
  /* ── Tokens ─────────────────────────────────────────────────────────── */
  html.theme-apple.theme-estate {
    /* EstateOS (nomad-estate/static/css/tokens.css) */
    --oxblood: #6f1a0f;
    --oxblood-deep: #4f1109;
    --oxblood-tint: #f6ece9;
    --charcoal: #1a1a1a;
    --charcoal-2: #262423;
    --on-dark: #d9d3cc;
    --on-dark-muted: #a39b93;
    --ink: #23201d;
    --muted: #6b645d;
    --paper: #faf7f2;
    --paper-2: #f3eee7;
    --surface: #ffffff;
    --line: #e6dfd5;
    --line-strong: #cfc6b9;
    --placeholder: #766e66;
    --hover: #fcfaf7;
    --hover-line: #b9ae9f;
    --ok: #1f6b45;
    --ok-tint: #e9f3ed;
    --warn: #9a5b00;
    --warn-tint: #fbf1e1;
    --danger: #a12a1c;
    --danger-tint: #fbebe8;
    --amber: #e0a46a;
    --avatar-dark: #302d2b;
    --shadow: 0 1px 2px rgb(26 26 26 / 5%);
    --shadow-panel: 0 1px 1px rgb(26 26 26 / 4%), 0 2px 4px -2px rgb(26 26 26 / 6%), 0 16px 32px -20px rgb(26 26 26 / 18%);
    --ring: 0 0 0 3px rgb(111 26 15 / 22%);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-display: -apple-system, BlinkMacSystemFont, "Segoe UI Variable Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --radius-sm: 6px;
    --radius: 8px;
    --radius-lg: 12px;
    --content-max: 1120px;
    --nav-width: 288px;
    --tabbar-height: 60px;

    /* The Apple names, remapped, so every kwetu.css rule that reads a
       token follows: colours and chrome only (see the header). */
    --bg: #faf7f2;
    --surface-raised: #f3eee7;
    --fill: #f3eee7;
    --fill-hover: #e6dfd5;
    --seg-on: #ffffff;
    --border: #cfc6b9;
    --border-subtle: #e6dfd5;
    --text: #23201d;
    --text-muted: #6b645d;
    --text-faint: #766e66;
    --accent: #6f1a0f;
    --accent-hover: #4f1109;
    --button: #6f1a0f;
    --button-hover: #4f1109;
    --accent-tint: #f6ece9;
    --focus-ring: 0 0 0 3px rgb(111 26 15 / 22%);
    --success: #1f6b45;
    --warning: #9a5b00;
    --danger-critical: #a12a1c;
    --success-dot: #1f6b45;
    --warning-dot: #9a5b00;
    --danger-dot: #a12a1c;
    --success-tint: #e9f3ed;
    --warning-tint: #fbf1e1;
    --avatar-male: #23201d;
    --avatar-female: #23201d;
    --bar: #6f1a0f;
    --bar-track: #f3eee7;
    --strip-bg: #1a1a1a;
    --strip-text: #d9d3cc;
    --tabbar-bg: #1a1a1a;
    --menu-shadow: 0 1px 1px rgb(26 26 26 / 4%), 0 2px 4px -2px rgb(26 26 26 / 6%), 0 16px 32px -20px rgb(26 26 26 / 18%);
    --rail-w: 288px;
    color-scheme: light;
  }
  /* A dark OS setting renders light: the same values again inside the
     query the Apple section uses for its dark tokens. */
  @media screen and (prefers-color-scheme: dark) {
    html.theme-apple.theme-estate {
      --bg: #faf7f2;
      --surface: #ffffff;
      --surface-raised: #f3eee7;
      --fill: #f3eee7;
      --fill-hover: #e6dfd5;
      --seg-on: #ffffff;
      --border: #cfc6b9;
      --border-subtle: #e6dfd5;
      --text: #23201d;
      --text-muted: #6b645d;
      --text-faint: #766e66;
      --accent: #6f1a0f;
      --accent-hover: #4f1109;
      --button: #6f1a0f;
      --button-hover: #4f1109;
      --accent-tint: #f6ece9;
      --focus-ring: 0 0 0 3px rgb(111 26 15 / 22%);
      --success: #1f6b45;
      --warning: #9a5b00;
      --danger: #a12a1c;
      --danger-critical: #a12a1c;
      --success-dot: #1f6b45;
      --warning-dot: #9a5b00;
      --danger-dot: #a12a1c;
      --success-tint: #e9f3ed;
      --warning-tint: #fbf1e1;
      --danger-tint: #fbebe8;
      --bar: #6f1a0f;
      --bar-track: #f3eee7;
      --strip-bg: #1a1a1a;
      --strip-text: #d9d3cc;
      --tabbar-bg: #1a1a1a;
      --menu-shadow: 0 1px 1px rgb(26 26 26 / 4%), 0 2px 4px -2px rgb(26 26 26 / 6%), 0 16px 32px -20px rgb(26 26 26 / 18%);
      color-scheme: light;
    }
  }

  /* ── Base ───────────────────────────────────────────────────────────── */
  html.theme-apple.theme-estate body {
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.5;
    letter-spacing: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }
  /* A report page's column keeps the Apple text metrics (rule 3b). */
  html.theme-apple.theme-estate [data-report-page] {
    font-size: var(--fs-body);
    line-height: 1.43;
    letter-spacing: -.016em;
  }
  html.theme-apple.theme-estate h1, html.theme-apple.theme-estate h2,
  html.theme-apple.theme-estate h3 {
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: -.015em;
    color: var(--ink);
  }
  html.theme-apple.theme-estate h4, html.theme-apple.theme-estate h5,
  html.theme-apple.theme-estate h6 { font-family: var(--font-display); font-weight: 600; letter-spacing: -.01em; }
  html.theme-apple.theme-estate a { color: var(--oxblood); text-underline-offset: 3px; }
  html.theme-apple.theme-estate a:hover { color: var(--oxblood-deep); }
  html.theme-apple.theme-estate :focus-visible { outline: 2px solid var(--oxblood); outline-offset: 2px; }
  html.theme-apple.theme-estate ::selection { background: var(--oxblood); color: #ffffff; }
  html.theme-apple.theme-estate .num,
  html.theme-apple.theme-estate .tabular { white-space: nowrap; font-variant-numeric: tabular-nums; }
  html.theme-apple.theme-estate .eyebrow {
    margin: 0 0 8px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
  }
  html.theme-apple.theme-estate .text-muted,
  html.theme-apple.theme-estate .text-secondary { color: var(--muted) !important; }
  html.theme-apple.theme-estate .text-primary { color: var(--oxblood) !important; }
  html.theme-apple.theme-estate .text-success { color: var(--ok) !important; }
  html.theme-apple.theme-estate .text-warning { color: var(--warn) !important; }
  html.theme-apple.theme-estate .text-danger { color: var(--danger) !important; }
  html.theme-apple.theme-estate .text-dark { color: var(--ink) !important; }
  html.theme-apple.theme-estate .bg-light { background-color: var(--paper-2) !important; }
  html.theme-apple.theme-estate .bg-white { background-color: var(--surface) !important; }
  html.theme-apple.theme-estate hr { border-color: var(--line); opacity: 1; }
  html.theme-apple.theme-estate .small, html.theme-apple.theme-estate small { letter-spacing: 0; }

  /* ── Page header: 32px title over a hairline ────────────────────────── */
  html.theme-apple.theme-estate .page-header:not([data-report-page] *) {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px 16px;
    margin: 0 0 24px;
    padding: 0 0 16px;
    border-bottom: 1px solid var(--line);
  }
  html.theme-apple.theme-estate .page-header h4:not([data-report-page] *) {
    margin: 0 0 4px;
    font-family: var(--font-display);
    font-size: 32px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -.02em;
    text-wrap: balance;
  }
  html.theme-apple.theme-estate .page-header h4 > i:not([data-report-page] *) { display: none; }
  html.theme-apple.theme-estate .page-header p:not([data-report-page] *),
  html.theme-apple.theme-estate .page-header .lead:not([data-report-page] *) {
    margin: 0;
    color: var(--muted);
    font-size: 16px;
    letter-spacing: 0;
  }
  html.theme-apple.theme-estate .page-header h4 .badge:not([data-report-page] *) {
    vertical-align: middle;
    font-size: 12px;
  }

  /* ── Panels (Bootstrap cards) ───────────────────────────────────────── */
  html.theme-apple.theme-estate .card:not([data-report-page] *) {
    background-color: var(--surface);
    border: 1px solid var(--line) !important;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-panel) !important;
    color: var(--ink);
  }
  html.theme-apple.theme-estate .card.shadow-sm:not([data-report-page] *) { box-shadow: var(--shadow-panel) !important; }
  html.theme-apple.theme-estate .card > .table-responsive:not([data-report-page] *),
  html.theme-apple.theme-estate .card > .card-body.p-0:not([data-report-page] *),
  html.theme-apple.theme-estate .card > .list-group:not([data-report-page] *) { border-radius: var(--radius-lg); }
  html.theme-apple.theme-estate .card-header:not([data-report-page] *) {
    background-color: transparent !important;
    border-bottom: 0 !important;
    padding: 16px 20px 0;
    color: var(--ink);
    font-size: 17px;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: 0;
  }
  html.theme-apple.theme-estate .card-header .small:not([data-report-page] *),
  html.theme-apple.theme-estate .card-header small:not([data-report-page] *),
  html.theme-apple.theme-estate .card-header .text-muted:not([data-report-page] *) {
    font-size: 13px;
    font-weight: 500;
  }
  html.theme-apple.theme-estate .card-body:not([data-report-page] *) { padding: 16px 20px 20px; }
  html.theme-apple.theme-estate .card-footer:not([data-report-page] *) {
    background-color: transparent;
    border-top: 1px solid var(--line);
    padding: 12px 20px;
    color: var(--muted);
    font-size: 13px;
  }
  html.theme-apple.theme-estate .card-header[style*="var(--danger)"]:not([data-report-page] *) {
    background: var(--danger) !important;
    color: #ffffff !important;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding-bottom: 16px;
  }
  /* The hard delete stays distinct (CLAUDE.md removal policy). */
  html.theme-apple.theme-estate .hard-delete-card:not([data-report-page] *) { border: 2px solid var(--danger) !important; }

  /* ── Tables: 14px, paper-2 header, hairlines, tabular numbers ───────── */
  html.theme-apple.theme-estate .table:not([data-report-page] *) {
    color: var(--ink);
    border-color: var(--line);
    font-size: 14px;
    letter-spacing: 0;
    font-variant-numeric: tabular-nums;
    margin-bottom: 0;
  }
  html.theme-apple.theme-estate .table > :not(caption) > * > *:not([data-report-page] *) {
    background-color: transparent;
    color: var(--ink);
    border-bottom-color: var(--line);
    padding: 12px 16px;
  }
  html.theme-apple.theme-estate .table-sm > :not(caption) > * > *:not([data-report-page] *) { padding: 8px 12px; }
  html.theme-apple.theme-estate .table th:not([data-report-page] *),
  html.theme-apple.theme-estate .table > thead > tr > th:not([data-report-page] *) {
    background: var(--paper-2);
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
    white-space: nowrap;
    border-bottom: 1px solid var(--line);
  }
  html.theme-apple.theme-estate .table th .sort-link:not([data-report-page] *) { color: var(--muted); }
  html.theme-apple.theme-estate .table th .sort-link:hover:not([data-report-page] *) { color: var(--oxblood); }
  html.theme-apple.theme-estate .table-light:not([data-report-page] *),
  html.theme-apple.theme-estate .table-light > *:not([data-report-page] *) {
    background-color: var(--paper-2) !important;
    color: var(--muted) !important;
  }
  html.theme-apple.theme-estate .table tbody tr:hover > *:not([data-report-page] *),
  html.theme-apple.theme-estate .table-hover > tbody > tr:hover > *:not([data-report-page] *) {
    background-color: var(--hover);
    color: var(--ink);
  }
  html.theme-apple.theme-estate .table > tbody > tr:last-child > *:not([data-report-page] *) { border-bottom: 0; }
  html.theme-apple.theme-estate .table td a.text-dark:not([data-report-page] *),
  html.theme-apple.theme-estate .table td a.text-decoration-none:not([data-report-page] *) {
    color: var(--ink);
    font-weight: 600;
  }
  html.theme-apple.theme-estate .table td a.text-dark:hover:not([data-report-page] *),
  html.theme-apple.theme-estate .table td a.text-decoration-none:hover:not([data-report-page] *) { color: var(--oxblood); }
  html.theme-apple.theme-estate .table tfoot td:not([data-report-page] *) {
    background: var(--paper-2);
    font-weight: 650;
    border-bottom: 0;
  }

  /* ── Status pills: a 6px dot and a word on a tint ────────────────────── */
  html.theme-apple.theme-estate .badge:not([data-report-page] *) {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 24px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    letter-spacing: .02em;
    font-variant-numeric: tabular-nums;
    vertical-align: middle;
  }
  html.theme-apple.theme-estate .badge.bg-success:not([data-report-page] *)::before,
  html.theme-apple.theme-estate .badge.bg-warning:not([data-report-page] *)::before,
  html.theme-apple.theme-estate .badge.bg-danger:not([data-report-page] *)::before,
  html.theme-apple.theme-estate .badge.bg-secondary:not([data-report-page] *)::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex: none;
  }
  /* Counts are not statuses: no dot in a heading, a tab, the rail or the
     result count. */
  html.theme-apple.theme-estate .page-header .badge:not([data-report-page] *)::before,
  html.theme-apple.theme-estate .nav-link .badge:not([data-report-page] *)::before,
  html.theme-apple.theme-estate .nav-tabs .badge:not([data-report-page] *)::before,
  html.theme-apple.theme-estate .result-count:not([data-report-page] *)::before,
  html.theme-apple.theme-estate .badge.estate-count:not([data-report-page] *)::before { content: none; }
  html.theme-apple.theme-estate .bg-success, html.theme-apple.theme-estate .badge.bg-success {
    background: var(--ok-tint) !important; color: var(--ok) !important;
  }
  html.theme-apple.theme-estate .bg-warning, html.theme-apple.theme-estate .badge.bg-warning,
  html.theme-apple.theme-estate .badge.bg-warning.text-dark {
    background: var(--warn-tint) !important; color: var(--warn) !important;
  }
  html.theme-apple.theme-estate .bg-danger, html.theme-apple.theme-estate .badge.bg-danger {
    background: var(--danger-tint) !important; color: var(--danger) !important;
  }
  html.theme-apple.theme-estate .bg-info, html.theme-apple.theme-estate .badge.bg-info,
  html.theme-apple.theme-estate .badge.bg-info.text-dark,
  html.theme-apple.theme-estate .bg-primary, html.theme-apple.theme-estate .badge.bg-primary {
    background: var(--oxblood-tint) !important; color: var(--oxblood) !important;
  }
  html.theme-apple.theme-estate .bg-secondary, html.theme-apple.theme-estate .badge.bg-secondary,
  html.theme-apple.theme-estate .badge.bg-light, html.theme-apple.theme-estate .text-bg-light {
    background: var(--paper-2) !important; color: var(--muted) !important;
  }
  html.theme-apple.theme-estate .bg-dark, html.theme-apple.theme-estate .badge.bg-dark,
  html.theme-apple.theme-estate .badge.estate-count {
    background: var(--charcoal) !important; color: #ffffff !important;
  }
  html.theme-apple.theme-estate .page-header .badge:not([data-report-page] *) {
    background: var(--paper-2) !important;
    color: var(--ink) !important;
  }
  html.theme-apple.theme-estate .bg-success-subtle { background-color: var(--ok-tint) !important; }
  html.theme-apple.theme-estate .bg-warning-subtle { background-color: var(--warn-tint) !important; }
  html.theme-apple.theme-estate .bg-danger-subtle { background-color: var(--danger-tint) !important; }
  html.theme-apple.theme-estate .border-success, html.theme-apple.theme-estate .border-success-subtle { border-color: var(--ok-tint) !important; }
  html.theme-apple.theme-estate .border-warning, html.theme-apple.theme-estate .border-warning-subtle { border-color: var(--warn-tint) !important; }
  html.theme-apple.theme-estate .border-danger, html.theme-apple.theme-estate .border-danger-subtle { border-color: var(--danger-tint) !important; }

  /* ── Buttons: 44px, radius 6; oxblood primary, quiet everything else ── */
  html.theme-apple.theme-estate .btn:not([data-report-page] *) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 24px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 15px;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: .005em;
    white-space: nowrap;
    box-shadow: none;
    transition: background-color 120ms, border-color 120ms, color 120ms;
  }
  html.theme-apple.theme-estate .btn-sm:not([data-report-page] *) { min-height: 40px; padding: 0 16px; font-size: 14px; letter-spacing: 0; }
  html.theme-apple.theme-estate .btn-lg:not([data-report-page] *) { min-height: 52px; padding: 0 28px; font-size: 16px; }
  html.theme-apple.theme-estate .btn:disabled:not([data-report-page] *),
  html.theme-apple.theme-estate .btn.disabled:not([data-report-page] *) { opacity: .5; }
  html.theme-apple.theme-estate .btn-primary:not([data-report-page] *),
  html.theme-apple.theme-estate .btn-kwetu:not([data-report-page] *),
  html.theme-apple.theme-estate .btn-success:not([data-report-page] *) {
    background: var(--oxblood);
    border-color: var(--oxblood);
    color: #ffffff;
  }
  html.theme-apple.theme-estate .btn-primary:hover:not([data-report-page] *),
  html.theme-apple.theme-estate .btn-primary:focus:not([data-report-page] *),
  html.theme-apple.theme-estate .btn-kwetu:hover:not([data-report-page] *),
  html.theme-apple.theme-estate .btn-kwetu:focus:not([data-report-page] *),
  html.theme-apple.theme-estate .btn-success:hover:not([data-report-page] *),
  html.theme-apple.theme-estate .btn-success:focus:not([data-report-page] *) {
    background: var(--oxblood-deep);
    border-color: var(--oxblood-deep);
    color: #ffffff;
  }
  html.theme-apple.theme-estate .btn-outline-secondary:not([data-report-page] *),
  html.theme-apple.theme-estate .btn-outline-primary:not([data-report-page] *),
  html.theme-apple.theme-estate .btn-outline-dark:not([data-report-page] *),
  html.theme-apple.theme-estate .btn-outline-success:not([data-report-page] *),
  html.theme-apple.theme-estate .btn-outline-warning:not([data-report-page] *),
  html.theme-apple.theme-estate .btn-outline-info:not([data-report-page] *),
  html.theme-apple.theme-estate .btn-secondary:not([data-report-page] *),
  html.theme-apple.theme-estate .btn-light:not([data-report-page] *),
  html.theme-apple.theme-estate .btn-info:not([data-report-page] *),
  html.theme-apple.theme-estate .btn-warning:not([data-report-page] *) {
    background: var(--surface);
    border-color: var(--line-strong);
    color: var(--ink);
  }
  html.theme-apple.theme-estate .btn-outline-secondary:hover:not([data-report-page] *),
  html.theme-apple.theme-estate .btn-outline-primary:hover:not([data-report-page] *),
  html.theme-apple.theme-estate .btn-outline-dark:hover:not([data-report-page] *),
  html.theme-apple.theme-estate .btn-outline-success:hover:not([data-report-page] *),
  html.theme-apple.theme-estate .btn-outline-warning:hover:not([data-report-page] *),
  html.theme-apple.theme-estate .btn-outline-info:hover:not([data-report-page] *),
  html.theme-apple.theme-estate .btn-secondary:hover:not([data-report-page] *),
  html.theme-apple.theme-estate .btn-light:hover:not([data-report-page] *),
  html.theme-apple.theme-estate .btn-info:hover:not([data-report-page] *),
  html.theme-apple.theme-estate .btn-warning:hover:not([data-report-page] *) {
    background: var(--paper-2);
    border-color: var(--hover-line);
    color: var(--ink);
  }
  html.theme-apple.theme-estate .btn-outline-danger:not([data-report-page] *) {
    background: transparent;
    border-color: var(--line-strong);
    color: var(--danger);
  }
  html.theme-apple.theme-estate .btn-outline-danger:hover:not([data-report-page] *),
  html.theme-apple.theme-estate .btn-outline-danger:focus:not([data-report-page] *) {
    background: var(--danger);
    border-color: var(--danger);
    color: #ffffff;
  }
  html.theme-apple.theme-estate .btn-danger:not([data-report-page] *),
  html.theme-apple.theme-estate .btn-hard-delete:not([data-report-page] *) {
    background: var(--danger);
    border-color: var(--danger);
    color: #ffffff;
  }
  html.theme-apple.theme-estate .btn-hard-delete:not([data-report-page] *) { box-shadow: 0 0 0 3px var(--danger-tint); }
  html.theme-apple.theme-estate .btn-danger:hover:not([data-report-page] *),
  html.theme-apple.theme-estate .btn-hard-delete:hover:not([data-report-page] *) {
    background: #7f1f13;
    border-color: #7f1f13;
    color: #ffffff;
  }
  html.theme-apple.theme-estate .btn-outline-light:not([data-report-page] *) { color: var(--on-dark); border-color: rgb(255 255 255 / 28%); background: transparent; }
  html.theme-apple.theme-estate .btn-link:not([data-report-page] *) {
    color: var(--oxblood);
    border: 0;
    min-height: 0;
    padding: 0;
    text-decoration: underline;
    text-underline-offset: 3px;
  }
  html.theme-apple.theme-estate .btn-close:not([data-report-page] *) { opacity: .6; }

  /* ── Forms: 48px fields, line-strong border, oxblood ring ───────────── */
  html.theme-apple.theme-estate .form-control:not([data-report-page] *),
  html.theme-apple.theme-estate .form-select:not([data-report-page] *) {
    min-height: 48px;
    padding: 10px 14px;
    background-color: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    color: var(--ink);
    font-family: var(--font);
    font-size: 16px;
    letter-spacing: 0;
    box-shadow: none;
    transition: border-color 120ms, box-shadow 120ms;
  }
  html.theme-apple.theme-estate .form-control-sm:not([data-report-page] *),
  html.theme-apple.theme-estate .form-select-sm:not([data-report-page] *) {
    min-height: 36px;
    padding: 6px 10px;
    font-size: 14px;
  }
  html.theme-apple.theme-estate textarea.form-control:not([data-report-page] *) { min-height: 112px; }
  html.theme-apple.theme-estate .form-control:not([data-report-page] *)::placeholder { color: var(--placeholder); }
  html.theme-apple.theme-estate .form-control:hover:not([data-report-page] *),
  html.theme-apple.theme-estate .form-select:hover:not([data-report-page] *) { border-color: var(--hover-line); }
  html.theme-apple.theme-estate .form-control:focus:not([data-report-page] *),
  html.theme-apple.theme-estate .form-select:focus:not([data-report-page] *) {
    background-color: var(--surface);
    border-color: var(--oxblood);
    color: var(--ink);
    box-shadow: var(--ring);
  }
  /* The ring is the focus indicator; the global outline above would draw a
     second one around it (the Apple rule that says so ties with the global
     outline on specificity and loses on order, so it is restated here). */
  html.theme-apple.theme-estate .form-control:focus-visible:not([data-report-page] *),
  html.theme-apple.theme-estate .form-select:focus-visible:not([data-report-page] *) { outline: none; }
  html.theme-apple.theme-estate .form-control:disabled:not([data-report-page] *),
  html.theme-apple.theme-estate .form-select:disabled:not([data-report-page] *) {
    background-color: var(--paper-2);
    color: var(--muted);
    border-color: var(--line);
  }
  html.theme-apple.theme-estate .form-label:not([data-report-page] *) {
    margin-bottom: 6px;
    color: var(--ink);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0;
  }
  html.theme-apple.theme-estate .form-text:not([data-report-page] *) { color: var(--muted); font-size: 13px; }
  html.theme-apple.theme-estate .form-check-input:not([data-report-page] *) {
    width: 20px;
    height: 20px;
    margin-top: 2px;
    background-color: var(--surface);
    border-color: var(--line-strong);
  }
  html.theme-apple.theme-estate .form-check-input:checked:not([data-report-page] *),
  html.theme-apple.theme-estate .form-check-input:indeterminate:not([data-report-page] *) {
    background-color: var(--oxblood);
    border-color: var(--oxblood);
  }
  html.theme-apple.theme-estate .form-check-input:focus:not([data-report-page] *) { border-color: var(--oxblood); box-shadow: var(--ring); }
  html.theme-apple.theme-estate .input-group-text:not([data-report-page] *) {
    background-color: var(--paper-2);
    border-color: var(--line-strong);
    border-radius: var(--radius-sm);
    color: var(--muted);
  }
  html.theme-apple.theme-estate .search-bar input:not([data-report-page] *) { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
  html.theme-apple.theme-estate .search-bar button:not([data-report-page] *) {
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    background: var(--oxblood);
    border: 0;
    color: #ffffff;
    padding: 0 16px;
  }
  html.theme-apple.theme-estate .search-bar button:hover:not([data-report-page] *) { background: var(--oxblood-deep); }
  @media screen and (forced-colors: active) {
    html.theme-apple.theme-estate .form-control:focus-visible:not([data-report-page] *),
    html.theme-apple.theme-estate .form-select:focus-visible:not([data-report-page] *) { outline: 2px solid CanvasText; }
  }

  /* ── Alerts: a 3px left edge ─────────────────────────────────────────── */
  html.theme-apple.theme-estate .alert:not([data-report-page] *) {
    padding: 12px 16px;
    border: 1px solid var(--line);
    border-left-width: 3px;
    border-left-color: var(--charcoal);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--ink);
    font-size: 15px;
  }
  html.theme-apple.theme-estate .alert-dismissible:not([data-report-page] *) { padding-right: 48px; }
  html.theme-apple.theme-estate .alert-success:not([data-report-page] *) { border-color: var(--ok); background: var(--ok-tint); color: var(--ok); }
  html.theme-apple.theme-estate .alert-warning:not([data-report-page] *) { border-color: var(--warn); background: var(--warn-tint); color: var(--warn); }
  html.theme-apple.theme-estate .alert-danger:not([data-report-page] *) { border-color: var(--danger); background: var(--danger-tint); color: var(--danger); }
  html.theme-apple.theme-estate .alert-info:not([data-report-page] *),
  html.theme-apple.theme-estate .alert-primary:not([data-report-page] *),
  html.theme-apple.theme-estate .alert-secondary:not([data-report-page] *),
  html.theme-apple.theme-estate .alert-light:not([data-report-page] *) {
    border-color: var(--line-strong);
    border-left-color: var(--charcoal);
    background: var(--surface);
    color: var(--ink);
  }
  html.theme-apple.theme-estate .alert .alert-link:not([data-report-page] *) { color: inherit; font-weight: 600; }

  /* ── Tabs: a 2px oxblood underline, muted labels, count pills ───────── */
  html.theme-apple.theme-estate .nav-tabs:not([data-report-page] *) {
    display: flex;
    flex-wrap: nowrap;
    gap: 0;
    padding: 0;
    margin: 0 0 24px;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    background: transparent;
    overflow-x: auto;
    scrollbar-width: none;
  }
  html.theme-apple.theme-estate .nav-tabs:not([data-report-page] *)::-webkit-scrollbar { display: none; }
  html.theme-apple.theme-estate .nav-tabs .nav-link:not([data-report-page] *) {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 48px;
    margin: 0;
    padding: 0 16px;
    border: 0 !important;
    border-radius: 0;
    background: transparent;
    color: var(--muted) !important;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0;
    white-space: nowrap;
  }
  html.theme-apple.theme-estate .nav-tabs .nav-link:first-child:not([data-report-page] *) { padding-left: 4px; }
  html.theme-apple.theme-estate .nav-tabs .nav-link:hover:not(.active):not([data-report-page] *) { color: var(--ink) !important; }
  html.theme-apple.theme-estate .nav-tabs .nav-link.active:not([data-report-page] *) {
    background: transparent;
    color: var(--ink) !important;
    box-shadow: inset 0 -2px 0 var(--oxblood);
  }
  html.theme-apple.theme-estate .nav-tabs .nav-link .badge:not([data-report-page] *) {
    min-width: 22px;
    height: 20px;
    min-height: 0;
    padding: 0 6px;
    background: var(--paper-2) !important;
    color: var(--muted) !important;
  }
  html.theme-apple.theme-estate .nav-tabs .nav-link.active .badge:not([data-report-page] *) {
    background: var(--oxblood-tint) !important;
    color: var(--oxblood) !important;
  }
  html.theme-apple.theme-estate .nav-tabs + .tab-content.card:not([data-report-page] *) { margin-top: 0; }

  /* ── Scope chips (the members_scopes inclusion tag) ─────────────────── */
  html.theme-apple.theme-estate .member-scopes:not([data-report-page] *) {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-width: none;
    margin: 0 0 24px;
    padding: 0;
    overflow: visible;
    border-radius: 0;
    background: transparent;
  }
  html.theme-apple.theme-estate .member-scope:not([data-report-page] *) {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 8px 0 16px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: var(--surface);
    color: var(--ink);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0;
    white-space: nowrap;
    text-decoration: none;
    box-shadow: none;
  }
  html.theme-apple.theme-estate .member-scope:hover:not([data-report-page] *) { border-color: var(--hover-line); color: var(--ink); }
  html.theme-apple.theme-estate .member-scope.active:not([data-report-page] *) {
    background: var(--oxblood);
    border-color: var(--oxblood);
    color: #ffffff;
    box-shadow: none;
  }
  html.theme-apple.theme-estate .member-scope-count:not([data-report-page] *) {
    display: inline-grid;
    place-items: center;
    min-width: 28px;
    height: 28px;
    padding: 0 8px;
    border-radius: 999px;
    background: var(--paper-2);
    color: var(--muted);
    font-size: 12px;
    font-weight: 650;
    letter-spacing: 0;
    font-variant-numeric: tabular-nums;
  }
  html.theme-apple.theme-estate .member-scope.active .member-scope-count:not([data-report-page] *) {
    background: rgb(255 255 255 / 18%);
    color: #ffffff;
  }
  html.theme-apple.theme-estate .member-scope-count-warn:not([data-report-page] *)::before,
  html.theme-apple.theme-estate .member-scope-count-bad:not([data-report-page] *)::before { content: none; }
  html.theme-apple.theme-estate .member-scope:not(.active) .member-scope-count-warn:not([data-report-page] *) { color: var(--warn); }
  html.theme-apple.theme-estate .member-scope:not(.active) .member-scope-count-bad:not([data-report-page] *) { color: var(--danger); }

  /* ── Pagination ─────────────────────────────────────────────────────── */
  html.theme-apple.theme-estate .pagination:not([data-report-page] *) { gap: 8px; margin: 24px 0 0; }
  html.theme-apple.theme-estate .page-link:not([data-report-page] *) {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 16px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--ink);
    font-size: 14px;
    font-weight: 600;
    box-shadow: none;
  }
  html.theme-apple.theme-estate .page-link:hover:not([data-report-page] *) { background: var(--paper-2); border-color: var(--hover-line); color: var(--ink); }
  html.theme-apple.theme-estate .page-item.active .page-link:not([data-report-page] *) {
    background: var(--oxblood);
    border-color: var(--oxblood);
    color: #ffffff;
  }
  html.theme-apple.theme-estate .page-item.disabled .page-link:not([data-report-page] *) { color: var(--muted); background: var(--surface); opacity: .6; }

  /* ── Progress bars ──────────────────────────────────────────────────── */
  html.theme-apple.theme-estate .progress:not([data-report-page] *) {
    height: 6px;
    border-radius: 3px;
    background-color: var(--paper-2);
    overflow: hidden;
  }
  html.theme-apple.theme-estate .progress-bar:not([data-report-page] *) { background: var(--oxblood); color: var(--surface); border-radius: 3px; }
  html.theme-apple.theme-estate .progress-bar.bg-success { background-color: var(--ok) !important; color: var(--surface) !important; }
  html.theme-apple.theme-estate .progress-bar.bg-warning { background-color: var(--warn) !important; color: var(--surface) !important; }
  html.theme-apple.theme-estate .progress-bar.bg-danger { background-color: var(--danger) !important; color: var(--surface) !important; }

  /* ── List groups ────────────────────────────────────────────────────── */
  html.theme-apple.theme-estate .list-group-item:not([data-report-page] *) {
    min-height: 48px;
    padding: 8px 16px;
    background: var(--surface);
    border-color: var(--line);
    color: var(--ink);
    font-size: 15px;
  }
  html.theme-apple.theme-estate .card > .list-group-flush > .list-group-item:not([data-report-page] *) { padding-left: 20px; padding-right: 20px; }
  html.theme-apple.theme-estate .list-group-item-action:hover:not([data-report-page] *),
  html.theme-apple.theme-estate .list-group-item-action:focus:not([data-report-page] *) { background: var(--paper); color: var(--ink); }

  /* ── Dropdown menus ─────────────────────────────────────────────────── */
  html.theme-apple.theme-estate .dropdown-menu:not([data-report-page] *) {
    padding: 6px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-panel);
    color: var(--ink);
  }
  html.theme-apple.theme-estate .dropdown-item:not([data-report-page] *) {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    color: var(--ink);
    font-size: 14px;
    font-weight: 500;
  }
  html.theme-apple.theme-estate .dropdown-item:hover:not([data-report-page] *),
  html.theme-apple.theme-estate .dropdown-item:focus:not([data-report-page] *) { background: var(--paper-2); color: var(--ink); }
  html.theme-apple.theme-estate .dropdown-item i:not([data-report-page] *) { color: var(--muted); }
  html.theme-apple.theme-estate .dropdown-divider:not([data-report-page] *) { border-top-color: var(--line); }

  /* ── Modals ─────────────────────────────────────────────────────────── */
  html.theme-apple.theme-estate .modal-content:not([data-report-page] *) {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-panel);
    color: var(--ink);
  }
  html.theme-apple.theme-estate .modal-header:not([data-report-page] *),
  html.theme-apple.theme-estate .modal-footer:not([data-report-page] *) { border-color: var(--line); padding: 16px 20px; }
  html.theme-apple.theme-estate .modal-body:not([data-report-page] *) { padding: 20px; }
  html.theme-apple.theme-estate .modal-title:not([data-report-page] *) { font-size: 20px; font-weight: 700; letter-spacing: -.01em; }

  /* ── Accordion ──────────────────────────────────────────────────────── */
  html.theme-apple.theme-estate .accordion-item:not([data-report-page] *) { background: var(--surface); border-color: var(--line); color: var(--ink); }
  html.theme-apple.theme-estate .accordion-button:not([data-report-page] *) {
    background: var(--surface);
    color: var(--ink);
    font-weight: 600;
    box-shadow: none;
  }
  html.theme-apple.theme-estate .accordion-button:not(.collapsed):not([data-report-page] *) { background: var(--paper-2); color: var(--ink); }
  html.theme-apple.theme-estate .accordion-button:focus:not([data-report-page] *) { border-color: var(--oxblood); box-shadow: var(--ring); }

  /* ── Breadcrumbs ────────────────────────────────────────────────────── */
  html.theme-apple.theme-estate .breadcrumb:not([data-report-page] *) { margin: 0 0 16px; font-size: 14px; color: var(--muted); }
  html.theme-apple.theme-estate .breadcrumb-item a:not([data-report-page] *) { color: var(--muted); font-weight: 600; text-decoration: none; }
  html.theme-apple.theme-estate .breadcrumb-item a:hover:not([data-report-page] *) { color: var(--oxblood); text-decoration: underline; }
  html.theme-apple.theme-estate .breadcrumb-item.active:not([data-report-page] *) { color: var(--ink); font-weight: 600; }
  html.theme-apple.theme-estate .breadcrumb-item + .breadcrumb-item:not([data-report-page] *)::before { color: var(--line-strong); }

  /* ── Avatars: a paper-2 circle, initials in ink ─────────────────────── */
  html.theme-apple.theme-estate .member-avatar:not([data-report-page] *),
  html.theme-apple.theme-estate .avatar-male:not([data-report-page] *),
  html.theme-apple.theme-estate .avatar-female:not([data-report-page] *) {
    background: var(--paper-2);
    color: var(--ink);
    font-weight: 650;
    letter-spacing: .04em;
  }

  /* ── Phone ──────────────────────────────────────────────────────────── */
  @media (max-width: 767.98px) {
    html.theme-apple.theme-estate .page-header:not([data-report-page] *) { margin-bottom: 20px; padding-bottom: 12px; }
    html.theme-apple.theme-estate .page-header h4:not([data-report-page] *) { font-size: 28px; line-height: 1.15; }
    html.theme-apple.theme-estate .card-header:not([data-report-page] *) { padding: 14px 16px 0; font-size: 16px; }
    html.theme-apple.theme-estate .card-body:not([data-report-page] *) { padding: 14px 16px 16px; }
    html.theme-apple.theme-estate .table > :not(caption) > * > *:not([data-report-page] *) { padding: 10px 12px; }
    /* The scope control becomes the mockup's four-up segmented control. */
    html.theme-apple.theme-estate .member-scopes:not([data-report-page] *) {
      display: grid;
      grid-template-columns: repeat(4, minmax(0, 1fr));
      gap: 0;
      margin: 0 0 16px;
      padding: 3px;
      border: 1px solid var(--line-strong);
      border-radius: var(--radius);
      background: var(--surface);
    }
    html.theme-apple.theme-estate .member-scope:not([data-report-page] *) {
      flex-direction: column-reverse;
      justify-content: center;
      gap: 0;
      min-height: 52px;
      padding: 4px;
      border: 0;
      border-radius: var(--radius-sm);
      background: none;
      font-size: 12px;
    }
    html.theme-apple.theme-estate .member-scope-count:not([data-report-page] *) {
      min-width: 0;
      height: auto;
      padding: 0;
      background: none;
      color: var(--ink);
      font-size: 16px;
    }
    html.theme-apple.theme-estate .member-scope.active:not([data-report-page] *) { background: var(--oxblood); }
    html.theme-apple.theme-estate .member-scope.active .member-scope-count:not([data-report-page] *) { background: none; color: #ffffff; }
  }
}
