/* Unified subject profile pane (D16 → Round 2, mockup 05) — loaded by admin.html.
   Two real zones (Public page / Internal case) under a sticky header that
   compacts on scroll. Styles were ported from mockups/overhaul/05-profile-tabs.html
   value-for-value — keep them in sync with the mockup, not "close enough". */

  .ir-wrap { max-width: 1320px; margin: 0 auto; }
  .ir-crumbs { font-size: 12px; color: var(--ink-3); letter-spacing: 0.04em; margin-bottom: 12px; }
  .ir-crumbs a { color: var(--navy-700); text-decoration: none; }

  /* ===== Sticky header: crumbs + subject + actions + zone tabs ===== */
  .ir-topbar {
    position: sticky; top: 0; z-index: 30; background: var(--canvas);
    margin: -32px calc(-1 * clamp(20px, 4vw, 48px)) 0;
    padding: 18px clamp(20px, 4vw, 48px) 0;
    border-bottom: 1px solid var(--hairline-strong);
  }
  .ir-topbar:has(.zone-tab[data-zone="internal"][aria-selected="true"]) { border-bottom-color: var(--navy-900); }
  .ir-head { display: flex; gap: 18px; align-items: center; }
  .ir-head > div:not(.ir-head__actions) { flex: 1; min-width: 0; }
    .chip--done { background: var(--navy-800); color: #fff; }
  .ir-head__photo--wide, .ir-head__ph--wide { width: 96px !important; height: 72px !important; object-position: center !important; }
  .ir-topbar.is-compact .ir-head__photo--wide, .ir-topbar.is-compact .ir-head__ph--wide { width: 52px !important; height: 39px !important; }
  .ir-head__photo { width: 64px; height: 80px; border-radius: 8px; object-fit: cover; object-position: top; box-shadow: var(--shadow-sm); background: var(--canvas-3); flex: none; }
  .ir-head__ph { width: 64px; height: 80px; border-radius: 8px; background: var(--canvas-3); box-shadow: var(--shadow-sm); display: flex; align-items: center; justify-content: center; color: var(--navy-400, #8aa1d4); font-weight: 700; font-size: 20px; letter-spacing: 0.05em; flex: none; }
  .ir-head__ph[hidden] { display: none; }
  .ir-head h1 { font-family: var(--font-display); color: var(--navy-800); font-size: 26px; font-weight: 600; line-height: 1.05; margin: 0; text-wrap: balance; }
  .ir-head .meta { color: var(--ink-3); font-size: 13px; margin-top: 6px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
  .ir-head__actions { margin-left: auto; display: flex; gap: 10px; align-self: center; align-items: center; flex: none; }
  @media (max-width: 900px) { .ir-head { flex-wrap: wrap; } .ir-head__actions { margin-left: 0; } }
  .ir-head__actions .btn svg { width: 13px; height: 13px; margin-right: 6px; vertical-align: -2px; }

  .chip { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; padding: 3px 10px; border-radius: var(--r-pill); background: var(--canvas-2); color: var(--navy-700); }
  .chip svg { width: 11px; height: 11px; flex: none; }
  .chip--open { background: #e7f2ea; color: var(--success); }
  .chip--warn { background: #f6efd8; color: #8a6d1e; }
  .chip--dark { background: var(--navy-900); color: #fff; }

  /* ⋯ menu: Print / Email / Delete */
  .more { position: relative; }
  .more > .btn { padding-left: 12px; padding-right: 12px; }
  .more > .btn svg { margin: 0; }
  .more__menu {
    position: absolute; right: 0; top: calc(100% + 6px); background: var(--paper); border-radius: var(--r-sm);
    box-shadow: var(--shadow-lg), 0 0 0 1px var(--hairline); min-width: 220px; padding: 6px; display: none; z-index: 40;
  }
  .more.is-open .more__menu { display: block; }
  .more__menu button {
    display: flex; width: 100%; gap: 10px; align-items: center; font: inherit; font-size: 13px; padding: 8px 10px;
    border: 0; background: none; color: var(--ink-2); border-radius: 4px; cursor: pointer; text-align: left; white-space: nowrap;
  }
  .more__menu button:hover { background: var(--canvas-2); color: var(--navy-800); }
  .more__menu button.danger { color: #b03a3a; }
  .more__menu hr { border: 0; border-top: 1px solid var(--hairline); margin: 6px 0; }
  .more__menu svg { width: 14px; height: 14px; color: var(--navy-500); flex: none; }

  /* The zone switch — two real tabs */
  .zones { display: flex; margin-top: 16px; }
  .zone-tab {
    flex: 1; display: flex; align-items: center; gap: 10px; padding: 12px 18px 13px;
    border: 1px solid var(--hairline-strong); border-bottom: 0; background: var(--canvas-2); color: var(--ink-3);
    font: inherit; font-weight: 700; font-size: 12.5px; letter-spacing: 0.09em; text-transform: uppercase; cursor: pointer;
    border-radius: var(--r-md) var(--r-md) 0 0; position: relative; min-width: 0;
  }
  .zone-tab + .zone-tab { margin-left: 8px; }
  .zone-tab svg { width: 16px; height: 16px; flex: none; }
  .zone-tab .sub { margin-left: auto; font-weight: 500; font-size: 12px; letter-spacing: 0.02em; text-transform: none; color: var(--ink-4); white-space: nowrap; }
  .zone-tab[aria-selected="true"] { color: var(--navy-800); background: var(--paper); }
  .zone-tab[aria-selected="true"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--paper); }
  .zone-tab[data-zone="internal"][aria-selected="true"] { background: var(--navy-900); color: #fff; border-color: var(--navy-900); }
  .zone-tab[data-zone="internal"][aria-selected="true"] .sub { color: #cfd9f2; }
  .zone-tab[data-zone="internal"][aria-selected="true"]::after { background: var(--navy-900); }

  /* Compact on scroll (hysteresis in JS): crumbs, chips, location and tab
     subtitles hide; the bar turns white with a shadow so it reads as a layer
     over the cards; the active public tab gets a navy top rule. Folder tabs
     stay — the owner rejected a pill variant. */
  .ir-topbar .ir-head__photo, .ir-topbar .ir-head__ph, .ir-topbar .ir-head h1, .zone-tab { transition: width .15s ease, height .15s ease, font-size .15s ease, padding .15s ease; }
  .ir-topbar.is-compact { padding-top: 10px; background: var(--paper); box-shadow: 0 10px 24px -12px rgba(20,36,80,0.35), 0 1px 0 var(--hairline-strong); }
  .ir-topbar.is-compact .ir-crumbs, .ir-topbar.is-compact .ir-head .meta, .ir-topbar.is-compact .zone-tab .sub { display: none; }
  .ir-topbar.is-compact .ir-head { gap: 12px; }
  .ir-topbar.is-compact .ir-head__photo, .ir-topbar.is-compact .ir-head__ph { width: 34px; height: 42px; font-size: 13px; }
  .ir-topbar.is-compact .ir-head h1 { font-size: 17px; }
  .ir-topbar.is-compact .zones { margin-top: 8px; }
  .ir-topbar.is-compact .zone-tab { padding: 8px 16px 9px; }
  .ir-topbar.is-compact .zone-tab[aria-selected="true"] { box-shadow: inset 0 2.5px 0 var(--navy-800); }
  .ir-topbar.is-compact .zone-tab[data-zone="internal"][aria-selected="true"] { box-shadow: none; }
  /* The compact/expand height change triggers browser scroll anchoring, which
     re-adjusts scrollY across the threshold and oscillates the header. */
  html { overflow-anchor: none; }

  /* ===== Zone bodies ===== */
  .zone { display: none; padding-top: 22px; }
  .zone.is-active { display: block; }
  .zone--public .ir-card { border: 1px solid var(--hairline-strong); box-shadow: 0 1px 2px rgba(20,36,80,0.04); }
  .zone-strip { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-radius: var(--r-md); font-size: 13px; margin-bottom: 20px; }
  .zone-strip svg { width: 15px; height: 15px; flex: none; }
  .zone-strip b { font-weight: 700; }
  .zone-strip .url { color: var(--navy-700); font-variant-numeric: tabular-nums; }
  .zone-strip .right { margin-left: auto; display: flex; gap: 12px; align-items: center; flex: none; }
  .zone-strip--public { background: var(--canvas-2); border: 1px solid var(--hairline-strong); color: var(--navy-700); }
  .zone-strip--internal { background: var(--navy-900); color: #cfd9f2; }
  .zone-strip--internal b { color: #fff; }
  .zone-strip button { color: inherit; font: inherit; font-weight: 700; text-decoration: underline; background: none; border: 0; cursor: pointer; padding: 0; }
  .zone-strip button[disabled] { opacity: .5; cursor: not-allowed; text-decoration: none; }

  .ir-card { background: var(--paper); border-radius: var(--r-md); box-shadow: var(--shadow-sm); padding: 20px 22px; margin-bottom: 18px; }
  .ir-card.is-editing { box-shadow: 0 0 0 2px var(--navy-500), 0 8px 24px rgba(20,36,80,0.10); }
  .ir-card h2 { font-family: var(--font-ui); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); font-weight: 700; margin: 0 0 14px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
  .ir-card h2 .count { color: var(--ink-4); font-weight: 500; letter-spacing: 0; text-transform: none; }
  .ir-card h2 .act { margin-left: auto; font-size: 12px; letter-spacing: 0; text-transform: none; display: flex; gap: 12px; align-items: center; }
  .ir-card h2 .act a, .ir-card h2 .act button { color: var(--navy-700); text-decoration: none; font-weight: 600; background: none; font-family: inherit; font-size: 12.5px; cursor: pointer; padding: 0; border: 0; display: inline-flex; gap: 5px; align-items: center; }
  .ir-card h2 .act svg { width: 12px; height: 12px; }

  /* Field cards (view): two columns for short fields, long text spans */
  dl.fields { display: grid; grid-template-columns: 1fr 1fr; column-gap: 32px; margin: 0; }
  .fld { padding: 11px 0; border-bottom: 1px solid var(--canvas-3); display: grid; grid-template-columns: 130px minmax(0,1fr); gap: 14px; align-items: baseline; }
  .fld--full { grid-column: 1 / -1; }
  .fld:last-of-type { border-bottom: 0; }
  .fld dt { font-size: 11px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--ink-4); font-weight: 600; padding-top: 2px; }
  .fld dd { color: var(--ink-2); margin: 0; min-width: 0; overflow-wrap: break-word; }
  .fld dd .val { white-space: pre-line; }
  .fld dd .val.na { color: var(--ink-4); font-style: italic; }
  @media (max-width: 1000px) { dl.fields { grid-template-columns: 1fr; } }
  @media (max-width: 700px) { .fld { grid-template-columns: 1fr; gap: 4px; } }

  /* Field cards (edit): ONE idiom — the card becomes a form */
  dl.ir-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 22px; margin: 0; }
  .ir-facts > div { min-width: 0; }
  .ir-facts > div.wide { grid-column: 1 / -1; }
  .ir-facts dd.na { color: var(--ink-4); font-style: italic; }
  /* medicines table (record card, portal) */
  table.meds { width: 100%; border-collapse: collapse; font-size: 13.5px; white-space: normal; margin-top: 4px; }
  table.meds th { text-align: left; font-size: 10.5px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--ink-4); font-weight: 600; padding: 0 10px 6px 0; border-bottom: 1px solid var(--hairline); }
  table.meds td { padding: 7px 10px 7px 0; border-bottom: 1px solid var(--canvas-3); vertical-align: top; color: var(--ink-2); }
  table.meds tr:last-child td { border-bottom: 0; }
  table.meds .meds__name { color: var(--ink); font-weight: 600; }
  /* medicines editor */
  .meds-edit { grid-column: 1 / -1; }
  .meds-edit .help { display: block; text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--ink-4); font-size: 12px; margin-top: 2px; }
  .meds-edit__note { font-size: 12.5px; color: var(--ink-3); margin: 8px 0; }
  .meds-edit__note summary { cursor: pointer; color: var(--navy-700); }
  .meds-edit__note textarea { margin-top: 6px; font-size: 12.5px; min-height: 90px; }
  .med-head, .med-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.2fr) 30px; gap: 8px; align-items: center; }
  .med-head { margin: 10px 0 4px; }
  .med-head span { font-size: 10.5px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--ink-4); font-weight: 600; }
  .med-row { margin-bottom: 8px; }
  .med-row input { font-size: 13.5px !important; padding: 8px 10px !important; }
  .med-rm { background: none; border: 0; color: var(--ink-4); cursor: pointer; font-size: 14px; padding: 6px; }
  .med-rm:hover { color: var(--danger); }
  #medsAdd { margin-top: 4px; }
  @media (max-width: 900px) { .med-head { display: none; } .med-row { grid-template-columns: 1fr 1fr; } .med-row input[data-k="name"] { grid-column: 1 / -1; } }
  .ir-facts dt { font-size: 11px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--ink-4); font-weight: 600; }
  .ir-facts dd { color: var(--ink-2); font-size: 14px; margin: 2px 0 0; overflow-wrap: break-word; white-space: pre-line; }
  @media (max-width: 700px) { dl.ir-facts { grid-template-columns: 1fr 1fr; } }

  .ir-recform { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; }
  .ir-recform[hidden] { display: none; }
  .ir-recform label { display: block; font-size: 11px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; }
  .ir-recform input, .ir-recform textarea, .ir-recform select { display: block; width: 100%; font: inherit; font-size: 14px; border: 1.5px solid var(--hairline-strong); border-radius: 8px; padding: 8px 10px; margin-top: 4px; box-sizing: border-box; background: var(--paper); color: var(--ink-2); }
  .ir-recform input:focus, .ir-recform textarea:focus { outline: 2px solid var(--navy-500); outline-offset: 1px; border-color: var(--navy-500); }
  .ir-recform .full { grid-column: 1 / -1; }
  .ir-recform textarea { min-height: 70px; resize: vertical; }
  .ir-recform label.check { display: flex; gap: 8px; align-items: center; text-transform: none; letter-spacing: 0; font-size: 13.5px; font-weight: 500; color: var(--ink-2); }
  .ir-recform label.check input { width: auto; margin: 0; }
  .ir-recform__foot { grid-column: 1 / -1; display: flex; gap: 10px; justify-content: flex-end; align-items: center; padding-top: 6px; }
  .ir-recform__foot .hint { margin-right: auto; color: var(--ink-4); font-size: 12.5px; }
  @media (max-width: 700px) { .ir-recform { grid-template-columns: 1fr; } }

  /* Fundraising campaign card */
  .camp { display: grid; grid-template-columns: auto minmax(0,1fr) auto; gap: 16px; align-items: center; }
  .camp__mark { width: 44px; height: 44px; border-radius: 10px; background: var(--canvas-2); display: grid; place-items: center; color: var(--navy-700); }
  .camp__mark svg { width: 22px; height: 22px; }
  .camp b { color: var(--navy-800); display: block; font-size: 14px; overflow-wrap: anywhere; }
  .camp .sub { color: var(--ink-3); font-size: 12.5px; }
  .camp .ops { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
  .camp-note { margin-top: 12px; }

  /* gallery management */
  .pgal { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
  .pgal__tile { margin: 0; border-radius: var(--r-sm); overflow: hidden; border: 1px solid var(--hairline); background: var(--paper); } /* figure's default 40px side margins were shrinking the tiles */
  .pgal__img { aspect-ratio: 16/9; background: var(--canvas-3); position: relative; }
  .pgal__img img { width: 100%; height: 100%; object-fit: cover; display: block; }
  .pgal__img .gchip { position: absolute; top: 8px; left: 8px; font-size: 10px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; background: var(--navy-900); color: #fff; border-radius: var(--r-pill); padding: 2px 8px; }
  .pgal__meta { padding: 8px 10px 9px; }
  .pgal__meta .cap { font-size: 12px; font-weight: 600; color: var(--ink-2); line-height: 1.35; display: block; }
  .pgal__meta .cap.na { color: var(--ink-4); font-style: italic; font-weight: 400; }
  .pgal__meta .cap-input {
    width: 100%; font: inherit; font-size: 12px; font-weight: 600; color: var(--ink-2);
    border: 1.5px solid var(--navy-500); border-radius: 6px; padding: 4px 7px; box-sizing: border-box;
  }
  .pgal__meta .row { display: flex; gap: 10px; margin-top: 5px; font-size: 11.5px; align-items: center; flex-wrap: wrap; }
  .pgal__meta .row button { color: var(--navy-700); font-weight: 600; background: none; border: 0; cursor: pointer; font-family: inherit; font-size: 11.5px; padding: 0; }
  .pgal__meta .row button.rm { color: var(--ink-4); }
  .pgal__meta .row select { font: inherit; font-size: 11.5px; border: 1px solid var(--hairline-strong); border-radius: 6px; padding: 1px 4px; color: var(--navy-700); }
  .pgal__add {
    border: 1.5px dashed var(--hairline-strong); border-radius: var(--r-sm); display: flex; flex-direction: column; gap: 6px;
    align-items: center; justify-content: center; color: var(--navy-700); font-weight: 600; font-size: 12.5px;
    min-height: 120px; cursor: pointer; background: var(--canvas);
  }
  .pgal__add svg { width: 20px; height: 20px; }
  .pgal__add-sub { font-size: 11.5px; font-weight: 400; color: var(--ink-4); text-align: center; max-width: 26ch; line-height: 1.35; }
  .pdf-add { width: 100%; }
  /* Empty gallery + empty PDF sit at the same height in their pair. */
  .two .pgal:has(> .pgal__add:only-child) { grid-template-columns: 1fr; }
  .two .pgal__add, .two .pdf-add { min-height: 132px; }
  .doc-add { width: 100%; min-height: 160px; }

  /* PDF slot */
  .pdf-slot { display: flex; align-items: center; gap: 14px; border: 1px solid var(--hairline); border-radius: var(--r-sm); padding: 14px 16px; background: var(--canvas); flex-wrap: wrap; }
  .pdf-slot__icon { width: 38px; height: 46px; border-radius: 4px; background: var(--paper); border: 1px solid var(--hairline-strong); display: flex; align-items: center; justify-content: center; color: var(--navy-500); flex: none; }
  .pdf-slot__icon svg { width: 18px; height: 18px; }
  .pdf-slot b { color: var(--navy-800); font-size: 13.5px; display: block; }
  .pdf-slot .sub { color: var(--ink-4); font-size: 12px; }
  .pdf-slot .acts { margin-left: auto; display: flex; gap: 14px; font-size: 12.5px; white-space: nowrap; }
  .pdf-slot .acts a, .pdf-slot .acts button { color: var(--navy-700); font-weight: 600; text-decoration: none; background: none; border: 0; cursor: pointer; font-family: inherit; font-size: 12.5px; padding: 0; }
  .pdf-slot .acts .rm { color: var(--ink-4); }

  /* expenses */
  .money { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
  th.money { text-align: right; padding-right: 0; }
  td.money { padding-right: 0; font-weight: 600; color: var(--ink-2); }
  .exp-table td:last-child, .exp-table th:last-child { padding-left: 14px; padding-right: 0; text-align: right; width: 1%; white-space: nowrap; }
  .exp-table tfoot td { border-top: 2px solid var(--hairline-strong); border-bottom: 0; font-weight: 700; color: var(--navy-800); padding-top: 12px; }
  .exp-note { margin-top: 14px; background: var(--canvas); border: 1px solid var(--hairline); border-radius: var(--r-sm); padding: 11px 14px; font-size: 12.5px; color: var(--ink-3); }
  .exp-note b { color: var(--ink-2); }
  .exp-form { display: grid; grid-template-columns: 130px 150px minmax(0,1fr) 110px auto; gap: 10px; align-items: end; margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--hairline-strong); }
  .exp-form[hidden] { display: none; }
  .exp-form label { font-size: 11px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; }
  .exp-form input, .exp-form select { display: block; width: 100%; font: inherit; font-size: 13.5px; border: 1.5px solid var(--hairline-strong); border-radius: 8px; padding: 7px 9px; margin-top: 4px; box-sizing: border-box; }
  @media (max-width: 860px) { .exp-form { grid-template-columns: 1fr 1fr; } }

  /* documents / comments / activity / share */
  table.ir-docs, table.exp-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
  .ir-docs th, .exp-table th { text-align: left; font-size: 11px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--ink-4); font-weight: 600; padding: 0 10px 8px 0; border-bottom: 1px solid var(--hairline); }
  .exp-table th.money { text-align: right; }
  .ir-docs td, .exp-table td { padding: 10px 10px 10px 0; border-bottom: 1px solid var(--canvas-3); vertical-align: top; }
  .ir-docs tr:last-child td { border-bottom: 0; }
  .ir-docs .doc { color: var(--navy-800); font-weight: 600; text-decoration: none; }
  .ir-docs .desc { color: var(--ink-2); max-width: 32ch; }
  .ir-docs .desc.na { color: var(--ink-4); font-style: italic; }
  .ir-docs .by, .exp-table .by { color: var(--ink-3); font-size: 12.5px; }
  .row-act { color: var(--navy-700); font-weight: 600; text-decoration: none; font-size: 12.5px; white-space: nowrap; background: none; font-family: inherit; cursor: pointer; padding: 0; border: 0; }
  .row-act.danger { color: #b03a3a; }
  .via-pill { background: #f6efd8; color: #8a6d1e; font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; border-radius: var(--r-pill); padding: 1px 7px; }

  .two { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 18px; margin-bottom: 18px; align-items: start; }
  .two .ir-card { margin-bottom: 0; }
  /* A pair where one card is hidden (projects have no "About the child") collapses to one column. */
  .two--auto:has(> [hidden]) { grid-template-columns: minmax(0,1fr); }
  /* Half-width field cards: one column of fields, costs fill their card. */
  .two .ir-card dl.fields { grid-template-columns: 1fr; }
  .two .ir-card .pub-costs-view { max-width: none; }
  .two .ir-card .ir-recform { grid-template-columns: 1fr; }
  .two .pgal { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  @media (max-width: 900px) { .two { grid-template-columns: 1fr; } .zone-tab .sub { display: none; } }

  .ir-cmt { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--canvas-3); }
  .ir-cmt:last-of-type { border-bottom: 0; }
  .ir-cmt__who { width: 34px; height: 34px; border-radius: 50%; background: var(--canvas-2); color: var(--navy-700); font-weight: 700; font-size: 12px; display: flex; align-items: center; justify-content: center; flex: none; }
  .ir-cmt__who--ext { background: var(--navy-800); color: #fff; }
  .ir-cmt__head { font-size: 12.5px; color: var(--ink-3); margin: 0; }
  .ir-cmt__head strong { color: var(--ink-2); }
  .ir-cmt p.body { margin: 3px 0 0; color: var(--ink-2); font-size: 14px; }
  .ir-cmt-box { display: flex; gap: 10px; margin-top: 14px; }
  .ir-cmt-box input { flex: 1; font: inherit; border: 1.5px solid var(--hairline-strong); border-radius: var(--r-pill); padding: 9px 16px; min-width: 0; }

  .ir-act-row { display: grid; grid-template-columns: 108px minmax(0,1fr); gap: 14px; padding: 7px 0; font-size: 13px; border-bottom: 1px dashed var(--canvas-3); }
  .ir-act-row:last-child { border-bottom: 0; }
  .ir-act-row time { color: var(--ink-4); font-size: 12px; padding-top: 1px; font-variant-numeric: tabular-nums; }
  .ir-act-row .who { font-weight: 600; color: var(--ink-2); }
  .ir-act-row .who.tok { color: var(--navy-700); }
  .ir-act-row .what { color: var(--ink-3); }

  .ir-link-row { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--canvas-3); font-size: 13px; }
  .ir-link-row:last-of-type { border-bottom: 0; }
  .ir-link-row .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); flex: none; margin-top: 5px; }
  .ir-link-row .dot--off { background: var(--ink-4); }
  .ir-link-row .lbl { font-weight: 600; color: var(--ink-2); }
  .ir-link-row .sub { color: var(--ink-4); font-size: 12px; display: block; }
  .ir-link-row .ops { margin-left: auto; display: flex; gap: 8px; flex: none; }
  .ir-link-row .ops button { color: var(--navy-700); font-weight: 600; font-size: 12px; background: none; font-family: inherit; cursor: pointer; padding: 0; border: 0; }
  .ir-link-row .ops button.danger { color: #b03a3a; }
  .share-scope { margin-top: 14px; background: var(--canvas-2); border: 1px solid var(--hairline-strong); border-radius: var(--r-sm); padding: 11px 14px; font-size: 12.5px; color: var(--navy-700); display: flex; gap: 9px; align-items: flex-start; }
  .share-scope svg { width: 14px; height: 14px; flex: none; margin-top: 2px; }

  /* one shared link per case (D17) */
  .sharelink { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
  .sharelink input {
    flex: 1; min-width: 200px; font: inherit; font-size: 13px; color: var(--navy-800);
    border: 1.5px solid var(--hairline-strong); border-radius: var(--r-pill); padding: 9px 14px;
    background: var(--canvas); font-variant-numeric: tabular-nums;
  }
  .sharelink .ops { display: flex; gap: 8px; flex: none; flex-wrap: wrap; }
  .sharelink__regen { color: #b03a3a; border-color: #d9b6b6; }

  .danger-foot { display: flex; align-items: center; gap: 14px; padding: 16px 0 0; color: var(--ink-4); font-size: 12.5px; }
  .danger-foot .btn { margin-left: auto; flex: none; }
  .btn--danger { background: transparent; border-color: #d9b6b6; color: #b03a3a; }
  .btn--danger:hover { background: #b03a3a; border-color: #b03a3a; color: #fff; }

  .empty { color: var(--ink-4); font-style: italic; font-size: 13.5px; }

  /* dialogs (photo, email link, email documents) */
  dialog.ir-dlg { border: 0; border-radius: var(--r-md); box-shadow: var(--shadow-lg); padding: 24px 26px; width: min(440px, 92vw); }
  dialog.ir-dlg::backdrop { background: rgba(21,39,95,0.35); }
  .ir-dlg h3 { font-family: var(--font-display); font-size: 19px; color: var(--navy-800); margin: 0 0 4px; }
  .ir-dlg .hint { color: var(--ink-3); font-size: 13px; margin: 0 0 16px; }
  .ir-dlg label { display: block; font-size: 11px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--ink-3); font-weight: 700; margin-bottom: 12px; }
  .ir-dlg input[type="text"], .ir-dlg input[type="email"], .ir-dlg textarea { display: block; width: 100%; font: inherit; font-size: 14px; border: 1.5px solid var(--hairline-strong); border-radius: 8px; padding: 9px 11px; margin-top: 4px; box-sizing: border-box; }
  .ir-dlg .caps label { display: flex; gap: 9px; align-items: center; text-transform: none; letter-spacing: 0; font-size: 13.5px; font-weight: 500; color: var(--ink-2); margin: 0 0 8px; }
  .ir-dlg .caps input { width: auto; margin: 0; }
  .ir-dlg .foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }
  .ir-dlg .err { color: #b03a3a; font-size: 13px; margin: 8px 0 0; }
  .ir-dlg .docpick label { display: flex; gap: 9px; align-items: center; text-transform: none; letter-spacing: 0; font-size: 13.5px; font-weight: 500; color: var(--ink-2); margin: 0 0 6px; }
  .ir-dlg .docpick input { width: auto; margin: 0; }
  dialog.ir-dlg--photo { width: min(580px, 94vw); }

  /* card-level public editing: value thumbnails + in-form photo picker */
  .fld dd .photo-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
  .fld dd .photo-line .val { overflow-wrap: anywhere; }
  .fld__thumb { width: 46px; height: 56px; object-fit: cover; border-radius: 6px; box-shadow: 0 0 0 1px var(--hairline); vertical-align: middle; margin-right: 10px; }
  .fld__thumb[hidden] { display: none; }
  .pub-photo-pick { display: flex; gap: 12px; align-items: center; margin-top: 6px; }
  .ir-recform input[hidden], .pub-photo-pick input[hidden] { display: none; }

  /* Photo widget inside the profile pane / photo popup */
  .profile-root .photo-preview, .ir-dlg .photo-preview {
    width: 120px;
    height: 150px; /* 4:5 portrait, matches the crop output */
    border-radius: var(--r-sm);
    background: var(--canvas-3) center/cover no-repeat;
    border: 1px solid var(--hairline);
    flex: none;
  }
  .photo-widget:has(.photo-editor:not([hidden])) .photo-preview,
  .photo-widget:has(.photo-editor:not([hidden])) .photo-widget__file,
  .photo-widget:has(.photo-editor:not([hidden])) [data-photo-adjust] { display: none; }
  .ir-dlg--photo .photo-editor { max-width: none; }
  .ir-dlg--photo .photo-viewport { width: min(100%, 336px); height: auto; aspect-ratio: 4 / 5; margin: 0 auto; }
  .ir-dlg--photo form:has(.photo-editor:not([hidden])) > .foot { display: none; }

  /* free-form care-costs editor */
  .pub-costs-form .cost-row { display: grid; grid-template-columns: minmax(0,1fr) 180px auto; gap: 10px; align-items: center; margin-bottom: 10px; }
  .pub-costs-form input { font: inherit; font-size: 14px; border: 1.5px solid var(--hairline-strong); border-radius: 8px; padding: 8px 10px; min-width: 0; }
  .pub-costs-form [data-cost-add] { margin: 4px 0 12px; }
  .pub-costs-view { max-width: 560px; }
  .pub-costs-view .fld { grid-template-columns: minmax(0,1fr) auto; }
  .pub-costs-view .fld dt { font-size: 13.5px; text-transform: none; letter-spacing: 0; color: var(--ink-2); font-weight: 400; }
  .pub-costs-view .fld dd { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
  .pub-costs-view .total { display: flex; justify-content: space-between; border-top: 2px solid var(--hairline-strong); padding-top: 10px; margin-top: 4px; font-weight: 700; color: var(--navy-800); }

  @media print {
    .admin__sidebar, .ir-head__actions, .ir-cmt-box, .zones, .zone-strip, .more, .danger-foot, [data-no-print] { display: none !important; }
    .zone { display: block !important; }
    .ir-topbar { position: static; box-shadow: none; }
    .ir-card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
    body { background: #fff; }
  }

  /* ---- Export dialog (sections left, live PDF right) ---- */
  /* Sized against the viewport with % (not vw/vh): the admin runs under CSS zoom,
     where vw/vh units come out 1.1× too large. */
  dialog.ir-dlg--export { position: fixed; inset: 0; margin: auto; width: min(1180px, calc(100% - 40px)); height: min(900px, calc(100% - 40px)); max-width: none; max-height: none; padding: 0; overflow: hidden; box-sizing: border-box; }
  .xp { display: grid; grid-template-rows: auto 1fr auto; height: 100%; }
  .xp__ctl, .xp__prev { min-height: 0; }
  .xp__head { display: flex; align-items: center; gap: 14px; padding: 16px 22px; border-bottom: 1px solid var(--hairline); }
  .xp__head h3 { margin: 0; }
  .xp__sub { color: var(--ink-3); font-size: 13px; }
  .xp__x { margin-left: auto; background: none; border: 0; color: var(--ink-4); font-size: 20px; cursor: pointer; }
  .xp__body { display: grid; grid-template-columns: 300px 1fr; min-height: 0; }
  .xp__ctl { border-right: 1px solid var(--hairline); padding: 18px 20px; background: var(--canvas); overflow: auto; }
  .xp__ctl h4 { font-family: var(--font-body); font-size: 11px; letter-spacing: 0.09em; text-transform: uppercase; color: var(--ink-4); margin: 16px 0 8px; }
  .xp__ctl h4:first-child { margin-top: 0; }
  .ir-dlg .xp__opt { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--canvas-3); cursor: pointer; text-transform: none; letter-spacing: 0; font-size: 13.5px; color: var(--ink); font-weight: 400; margin: 0; }
  .ir-dlg .xp__opt:last-child { border-bottom: 0; }
  .ir-dlg .xp__opt input { position: absolute; opacity: 0; width: 0; height: 0; }
  .xp__sw { width: 34px; height: 20px; border-radius: var(--r-pill); background: var(--canvas-3); position: relative; flex: none; margin-top: 2px; transition: background .15s; }
  .xp__sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,0.25); transition: left .15s; }
  .ir-dlg .xp__opt.is-on .xp__sw { background: var(--navy-800); }
  .ir-dlg .xp__opt.is-on .xp__sw::after { left: 16px; }
  .ir-dlg .xp__opt input:focus-visible + .xp__sw { outline: 2px solid var(--navy-700); outline-offset: 2px; }
  .ir-dlg .xp__opt b { display: block; font-weight: 600; color: var(--ink); }
  .ir-dlg .xp__opt:not(.is-on) b { color: var(--ink-3); }
  .ir-dlg .xp__opt small { display: block; color: var(--ink-3); font-size: 12px; line-height: 1.35; }
  .xp__adm { display: inline-block; font-size: 9.5px; letter-spacing: 0.08em; text-transform: uppercase; font-weight: 700; padding: 1px 6px; border-radius: var(--r-pill); background: #fff3cd; color: #7a5a00; margin-left: 6px; vertical-align: middle; font-style: normal; }
  .xp__seg { display: flex; border: 1px solid var(--hairline); border-radius: 8px; overflow: hidden; background: #fff; }
  .xp__seg button { flex: 1; padding: 6px 0; font-weight: 600; font-size: 12.5px; font-family: var(--font-body); color: var(--ink-3); background: none; border: 0; cursor: pointer; }
  .xp__seg button.is-on { background: var(--navy-800); color: #fff; }
  .ir-dlg .xp__note { font-size: 12px; color: var(--ink-3); margin: 8px 0 0; text-transform: none; letter-spacing: 0; font-weight: 400; }
  .ir-dlg .xp__lbl { display: block; margin-bottom: 12px; }
  .xp__lbl input, .xp__lbl textarea { display: block; width: 100%; margin-top: 4px; }
  /* The PDF plugin (Safari especially) ignores flex/grid percentage heights and
     paints over the footer — so the frame is pinned inside the preview box. */
  .xp__prev { background: #c9d1e0; position: relative; min-height: 0; overflow: hidden; }
  .xp__hint { text-align: center; color: var(--ink-2); font-size: 12px; margin: 0; padding: 8px 12px 6px; height: 20px; line-height: 20px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .xp__frame { position: absolute; left: 0; top: 34px; width: 100%; height: calc(100% - 34px); border: 0; background: transparent; }
  .xp__loading { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(201,209,224,0.7); color: var(--navy-800); font-weight: 600; }
  .xp__foot { display: flex; align-items: center; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--hairline); background: #fff; }
  .xp__foot .xp__meta { color: var(--ink-3); font-size: 13px; }
  .xp__foot .xp__sp { flex: 1; }
  .xp__foot > span > * + * { margin-left: 8px; }
  @media (max-width: 860px) {
    .xp__body { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
    .xp__ctl { border-right: 0; border-bottom: 1px solid var(--hairline); max-height: 40vh; }
  }
