
    :root {
      --black: #000;
      --ink: #111;
      --text: #333;
      --text-muted: #666;
      --text-faint: #777;
      --bg: #f7f7f7;
      --white: #fff;
      --border: #e6e6e6;
      --border-strong: #ddd;
      --radius-lg: 18px;
      --radius-md: 12px;
      --radius-sm: 8px;
      --shadow-card: 0 10px 30px rgba(0,0,0,.08);
      --shadow-hover: 0 18px 36px rgba(0,0,0,.12);
      --green-bg: #d4edda; --green-text: #155724;
      --amber-bg: #fff3cd; --amber-text: #856404;
      --gray-bg: #e2e3e5;  --gray-text2: #383d41;
      --red-bg: #f8d7da;   --red-text: #721c24;
      --blue-bg: #cce5ff;  --blue-text: #004085;
      --cyan-bg: #d1ecf1;  --cyan-text: #0c5460;
      /* Orange (New Application) and Navy (Funded) — added so every loan
         status badge color is distinct: Approved uses --amber (yellow),
         Processing uses --blue, Funded needs a visibly darker/richer
         blue than Processing so the two don't read as the same color. */
      --orange-bg: #ffe1c2; --orange-text: #a15c00;
      --navy-bg: #c3d6f0;   --navy-text: #0d2b57;
      /* Only used by the System Health view's "needs review" pill — added
         here (rather than left duplicated in a per-view :root, which
         wouldn't work the same way CSS custom properties cascade) when
         that view was folded in from its own standalone page. */
      --purple-bg: #e6dbf7; --purple-text: #4b2e83;
      --focus-ring: 0 0 0 4px rgba(0,0,0,.08);
      /* Only used by Dev Mode's recipient cards / rich-text toolbar — an
         accent color layered on top of the app's existing black/white/gray
         system rather than replacing it anywhere else. */
      --accent: #3654E0; --accent-bg: #eef1ff;
    }
    * { box-sizing: border-box; }
    html, body {
      margin: 0;
      padding: 0;
      min-height: 100%;
      min-height: 100dvh;
      -webkit-text-size-adjust: none;
      text-size-adjust: none;
    }
    body {
      display: flex;
      flex-direction: column;
      font-family: Arial, Helvetica, sans-serif;
      color: var(--ink);
      background: var(--bg);
    }
    img { max-width: 100%; height: auto; }

    /* ---- Topbar (matches fyzlgroup.com apps) ---- */
    .topbar {
      background: var(--black);
      padding: 10px 20px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 12px;
      flex-wrap: wrap;
    }
    .topbar-brand { display: flex; align-items: center; gap: 14px; }
    .topbar-brand img { height: auto; width: 190px; max-width: 45vw; display: block; }
    .topbar-appname {
      color: #d9d9d9;
      font-size: 12px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 1px;
      border-left: 1px solid rgba(255,255,255,.3);
      padding-left: 14px;
    }
    .topbar-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
    .topbar-user {
      color: #b9b9b9;
      font-size: 12px;
      margin-right: 4px;
      white-space: nowrap;
    }

    h1, h2, h3, h4 {
      margin-top: 0;
      font-weight: 700;
      letter-spacing: .2px;
      color: var(--ink);
    }

    main { flex: 1; width: 100%; max-width: 1080px; margin: 0 auto; padding: 30px 24px 60px; box-sizing: border-box; }

    /* ---- Buttons ---- */
    .btn {
      border: none;
      border-radius: var(--radius-sm);
      padding: 10px 16px;
      font-size: 13px;
      font-weight: 700;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      gap: 6px;
      transition: .2s ease;
      font-family: inherit;
      text-decoration: none;
    }
    .btn:disabled { opacity: .55; cursor: default; }
    .btn-primary { background: var(--black); color: var(--white); }
    .btn-primary:hover:not(:disabled) { opacity: .85; }
    .btn-secondary {
      background: var(--white); color: var(--ink);
      border: 1px solid var(--border-strong);
      box-shadow: 0 4px 12px rgba(0,0,0,.05);
    }
    .btn-secondary:hover:not(:disabled) { background: var(--black); color: var(--white); border-color: var(--black); }
    .btn-ghost { background: transparent; color: var(--white); border: 1px solid rgba(255,255,255,.55); }
    .btn-ghost:hover:not(:disabled) { background: var(--white); color: var(--black); }
    .btn-danger { background: var(--red-text); color: var(--white); }
    .btn-danger:hover:not(:disabled) { opacity: .85; }

    /* ---- Custom confirm dialog (replaces window.confirm — Apps Script's
       IFRAME sandbox renders the native confirm() with the raw
       googleusercontent.com sandbox URL in it, which reads as broken/
       untrustworthy inside a Squarespace embed). Sits above any other
       open modal via a higher z-index, since it can be triggered from
       inside the Loan Status modal (Clear Status) as well as the row
       actions and Manage Users. ---- */
    #confirm-overlay { z-index: 200; }
    #confirm-modal { max-width: 420px; }
    #confirm-modal .modal-body p { margin: 0; line-height: 1.5; }

    .toolbar {
      display: flex;
      gap: 12px;
      align-items: center;
      margin-bottom: 18px;
      flex-wrap: wrap;
    }
    .search-box { flex: 1; min-width: 220px; position: relative; }
    .search-box input {
      width: 100%;
      padding: 12px 14px;
      border: 1px solid var(--border-strong);
      border-radius: var(--radius-md);
      font-size: 14px;
      background: var(--white);
      font-family: inherit;
    }
    .search-box input:focus { outline: none; border-color: var(--ink); box-shadow: var(--focus-ring); }
    .result-count { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
    .cadence-note { font-size: 12.5px; color: var(--text-muted); margin: -6px 0 16px; line-height: 1.5; }

    .live-indicator {
      font-size: 11.5px;
      color: var(--text-muted);
      display: inline-flex;
      align-items: center;
      gap: 6px;
      white-space: nowrap;
    }
    .live-indicator .dot {
      width: 7px; height: 7px; border-radius: 50%;
      background: #c7c7c7;
      flex: none;
    }
    .live-indicator.is-live .dot {
      background: var(--green-text);
      animation: live-pulse 1.6s ease-in-out infinite;
    }
    @keyframes live-pulse {
      0%, 100% { box-shadow: 0 0 0 0 rgba(21,87,36,.35); }
      50% { box-shadow: 0 0 0 4px rgba(21,87,36,0); }
    }

    .btn-xs { padding: 6px 11px; font-size: 11.5px; }
    /* Fixed widths so "Clear Status" / "Conditions" / "Run a Command"
       land in the exact same spot on every row regardless of which
       buttons a given row has — flex-wrap is off on purpose (desktop
       always has room for all three; the @media block below switches to
       a stacked full-width layout on narrow screens anyway). */
    table.rows-table .row-actions {
      display: flex;
      gap: 8px;
      justify-content: flex-end;
      flex-wrap: nowrap;
    }
    table.rows-table .row-actions .btn { justify-content: center; }
    table.rows-table .row-actions .btn[data-clear-row] { width: 108px; }
    table.rows-table .row-actions .btn[data-conditions-row] { width: 104px; }
    table.rows-table .row-actions .btn[data-row] { width: 132px; }
    /* Reserves the Clear Status button's space on rows where it doesn't
       apply, so Conditions/Run a Command still land in the same spot —
       invisible (not display:none) keeps its layout box; not clickable
       or announced to screen readers either way. */
    table.rows-table .row-actions .btn.invisible {
      visibility: hidden;
      pointer-events: none;
    }

    .banner {
      border-radius: var(--radius-md);
      padding: 13px 16px;
      font-size: 13px;
      margin-bottom: 18px;
      display: none;
      border: 1px solid transparent;
    }
    .banner.show { display: block; }
    .banner.success { background: var(--green-bg); color: var(--green-text); border-color: #bcdfc4; }
    .banner.error   { background: var(--red-bg);   color: var(--red-text);   border-color: #f0c3c8; }
    .banner.info    { background: #f1f1f1;         color: var(--ink);       border-color: var(--border-strong); }

    .card {
      background: var(--white);
      border-radius: var(--radius-lg);
      box-shadow: var(--shadow-card);
      overflow: hidden;
    }

    table.rows-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
    table.rows-table thead th {
      text-align: left;
      background: #fafafa;
      color: var(--text-faint);
      font-size: 11px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: .06em;
      padding: 12px 16px;
      border-bottom: 1px solid var(--border);
    }
    table.rows-table tbody td {
      padding: 14px 16px;
      border-bottom: 1px solid var(--border);
      vertical-align: middle;
    }
    table.rows-table tbody tr:last-child td { border-bottom: none; }
    table.rows-table tbody tr:hover { background: #fbfbfb; }
    .client-name { font-weight: 700; color: var(--ink); }
    .loan-number { color: var(--text-muted); font-size: 12px; font-weight: 700; }
    .client-name-link {
      background: none; border: none; padding: 0; margin: 0;
      font: inherit; font-weight: 700; color: var(--ink); cursor: pointer;
      text-align: left;
    }
    .client-name-link:hover { text-decoration: underline; color: #000; }
    .client-name-link:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 3px; }

    /* ---- Loan Status popup (condensed version of the client-facing
       "Loan Status" portal — same status color conditions) ---- */
    .loan-status-badge-row { margin-bottom: 18px; }
    .loan-status-badge {
      display: inline-block;
      padding: 8px 18px;
      border-radius: 999px;
      font-size: 13px;
      font-weight: 700;
      letter-spacing: .3px;
    }
    .loan-status-badge-neutral { background: #f3f4f6; color: #666; }
    .loan-status-badge.ctc        { background: var(--green-bg);  color: var(--green-text); }
    .loan-status-badge.approved   { background: var(--amber-bg);  color: var(--amber-text); }
    .loan-status-badge.new        { background: var(--orange-bg); color: var(--orange-text); }
    .loan-status-badge.processing { background: var(--blue-bg);   color: var(--blue-text); }
    .loan-status-badge.funded     { background: var(--navy-bg);   color: var(--navy-text); }
    .loan-status-badge.problem    { background: var(--red-bg);   color: var(--red-text); }

    .loan-status-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 12px;
      margin-bottom: 22px;
    }
    .loan-status-box {
      background: #fafafa;
      border: 1px solid var(--border);
      border-radius: var(--radius-md);
      padding: 14px 16px;
    }
    .loan-status-box.full { grid-column: 1 / -1; }
    .loan-status-box-label {
      font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
      color: var(--text-faint); margin-bottom: 6px;
    }
    .loan-status-box-value { font-size: 14.5px; font-weight: 600; color: var(--ink); word-break: break-word; }

    .loan-status-section-title {
      font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
      color: var(--text-faint); margin: 4px 0 10px;
    }

    /* Horizontal by default (matches the desktop timeline in the Loan
       Status app) — a connecting line behind evenly-spaced steps, each
       with its circle centered above the title/status. Falls back to a
       stacked vertical list on narrow screens, same as that app does. */
    .loan-status-timeline {
      display: grid;
      grid-template-columns: repeat(7, 1fr);
      gap: 4px;
      position: relative;
      margin: 16px 0 4px;
      padding: 0 6px;
    }
    .loan-status-timeline::before {
      content: "";
      position: absolute;
      top: 16px;
      left: 40px;
      right: 40px;
      height: 3px;
      background: #e5e5e5;
      border-radius: 10px;
      z-index: 0;
    }
    .loan-status-step {
      position: relative;
      z-index: 1;
      display: flex;
      flex-direction: column;
      align-items: center;
      text-align: center;
      gap: 6px;
    }
    .loan-status-step-icon {
      width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
      display: flex; align-items: center; justify-content: center;
      font-size: 13px; font-weight: bold;
    }
    .loan-status-step-icon.complete { background: var(--green-bg); color: var(--green-text); }
    .loan-status-step-icon.pending  { background: #f0f0f0; color: #bbb; border: 2px solid #ddd; }
    .loan-status-step-title  { font-size: 10.5px; font-weight: 700; color: var(--ink); line-height: 1.25; }
    .loan-status-step-status { font-size: 9.5px; color: var(--text-muted); margin-top: 1px; line-height: 1.25; }

    .loan-status-notes {
      background: #fafafa; border: 1px solid var(--border); border-radius: var(--radius-md);
      padding: 12px 14px; font-size: 12.5px; color: var(--text); line-height: 1.6;
      white-space: pre-line; max-height: 200px; overflow-y: auto;
    }
    .loan-status-notes-empty { color: var(--text-faint); font-style: italic; }
    .loan-status-notes-title {
      display: flex; align-items: center; gap: 8px; margin-bottom: 10px;
    }
    .loan-status-notes-title .loan-status-section-title { margin: 0; }
    .notes-edit-btn {
      background: none; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
      width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center;
      font-size: 12px; line-height: 1; cursor: pointer; color: var(--text-muted); padding: 0;
      flex-shrink: 0;
    }
    .notes-edit-btn:hover { background: var(--black); color: var(--white); border-color: var(--black); }
    .notes-textarea {
      width: 100%; box-sizing: border-box; min-height: 90px; padding: 11px 12px;
      border: 1px solid var(--border-strong); border-radius: var(--radius-md);
      font-size: 12.5px; font-family: inherit; line-height: 1.5; resize: vertical;
    }
    .notes-textarea:focus { outline: none; border-color: var(--ink); box-shadow: var(--focus-ring); }
    .notes-edit-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
    #notes-error.banner { margin-top: 10px; }

    .pill {
      display: inline-block;
      padding: 4px 12px;
      border-radius: 999px;
      font-size: 11px;
      font-weight: 700;
      letter-spacing: .2px;
      white-space: nowrap;
    }
    .pill-neutral    { background: #f3f4f6; color: #999; }
    .pill-pending    { background: var(--amber-bg); color: var(--amber-text); }
    .pill-sent       { background: var(--green-bg); color: var(--green-text); }
    .pill-error      { background: var(--red-bg);   color: var(--red-text); }
    .pill-processing { background: var(--gray-bg);  color: var(--gray-text2); }

    .empty-state, .loading-state {
      padding: 60px 20px;
      text-align: center;
      color: var(--text-muted);
      font-size: 14px;
    }

    /* ---- Modal ---- */
    .overlay {
      display: none;
      position: fixed;
      inset: 0;
      background: rgba(0,0,0,.5);
      z-index: 50;
      align-items: flex-start;
      justify-content: center;
      padding: 24px 16px calc(24px + env(safe-area-inset-bottom));
      overflow-y: auto;
    }
    .overlay.show { display: flex; }
    .modal {
      background: var(--white);
      border-radius: var(--radius-lg);
      width: 100%;
      max-width: 560px;
      margin-top: 20px;
      box-shadow: 0 20px 60px rgba(0,0,0,.28);
    }
    /* Wider than the default modal so the 7-step horizontal timeline has
       room to breathe. */
    #status-modal { max-width: 740px; }
    /* System Health's own detail modal is wider still, for its event list. */
    #health-detail-modal { max-width: 760px; }
    .modal-header {
      padding: 22px 26px;
      border-bottom: 1px solid var(--border);
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 10px;
    }
    .modal-header h2 { font-size: 20px; margin: 0 0 4px; }
    .modal-header .sub { font-size: 13px; color: var(--text-muted); }
    .modal-close {
      background: none; border: none; cursor: pointer; font-size: 22px;
      color: var(--text-muted); line-height: 1; padding: 2px 6px;
    }
    .modal-close:hover { color: var(--ink); }
    .modal-body { padding: 22px 26px; }
    .modal-footer {
      padding: 18px 26px calc(18px + env(safe-area-inset-bottom));
      border-top: 1px solid var(--border);
      display: flex;
      justify-content: flex-end;
      gap: 10px;
    }

    label.field-label {
      display: block;
      font-size: 13px;
      font-weight: 700;
      margin-bottom: 6px;
      color: var(--ink);
    }
    .field-group { margin-bottom: 16px; }
    .field-help { font-size: 12px; color: var(--text-muted); margin-top: 5px; line-height: 1.4; }
    select, input[type=text], input[type=number], input[type=email], input[type=date], input[type=password] {
      width: 100%;
      padding: 11px 12px;
      border: 1px solid var(--border-strong);
      border-radius: var(--radius-md);
      font-size: 14px;
      background: var(--white);
      font-family: inherit;
      min-height: 44px;
      -webkit-appearance: none;
      appearance: none;
    }
    select:focus, input:focus { outline: none; border-color: var(--ink); box-shadow: var(--focus-ring); }
    .checkbox-row { display: flex; align-items: center; gap: 8px; min-height: 44px; }
    .checkbox-row input { width: 18px; height: 18px; min-height: auto; }

    /* ---- Update Rates ---- */
    .file-drop {
      border: 2px dashed var(--border-strong);
      border-radius: var(--radius-md);
      background: #fafafa;
      padding: 16px;
      transition: .2s;
    }
    .file-drop:hover { border-color: var(--ink); background: #f3f3f3; }
    .file-drop input[type=file] {
      width: 100%;
      font-size: 13px;
      font-family: inherit;
      cursor: pointer;
    }
    .file-drop .file-chosen { font-size: 12.5px; color: var(--ink); font-weight: 700; margin-top: 8px; }
    .btn-primary.is-success { background: var(--green-text); }
    .btn-primary:disabled.is-success { opacity: 1; }

    .command-explainer {
      background: #f4f4f4;
      border: 1px solid var(--border);
      border-radius: var(--radius-md);
      padding: 14px 16px;
      font-size: 13.5px;
      color: var(--text);
      margin-bottom: 18px;
      line-height: 1.55;
    }
    .command-explainer .req {
      display: block;
      margin-top: 9px;
      font-size: 12.5px;
      color: var(--text-muted);
    }
    .command-explainer .req b { color: var(--ink); }

    .command-example {
      display: block;
      margin-bottom: 18px;
      text-decoration: none;
    }
    .command-example img {
      display: block;
      width: 100%;
      max-height: 280px;
      object-fit: contain;
      background: #fafafa;
      border: 1px solid var(--border-strong);
      border-radius: var(--radius-md);
      cursor: zoom-in;
      transition: .2s;
    }
    .command-example:hover img { border-color: var(--ink); }
    .command-example .caption {
      display: block;
      font-size: 11.5px;
      color: var(--text-muted);
      margin-top: 6px;
    }
    .status-note {
      background: var(--white);
      border: 1px solid var(--border-strong);
      border-radius: var(--radius-md);
      padding: 10px 14px;
      font-size: 12.5px;
      color: var(--text-muted);
      margin-bottom: 18px;
    }
    .status-note b { color: var(--ink); }
    .status-note-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      flex-wrap: wrap;
    }

    .placeholder-hint {
      font-size: 13px;
      color: var(--text-muted);
      padding: 6px 0 2px;
    }

    .access-denied {
      max-width: 480px;
      margin: 70px auto;
      text-align: center;
      padding: 40px 32px;
      background: var(--white);
      border-radius: var(--radius-lg);
      box-shadow: var(--shadow-card);
    }
    .access-denied h1 { font-size: 21px; margin-bottom: 12px; }
    .access-denied p { color: var(--text-muted); font-size: 14px; line-height: 1.65; margin: 0; }

    .spinner {
      width: 15px; height: 15px;
      border-radius: 50%;
      border: 2px solid rgba(255,255,255,.4);
      border-top-color: var(--white);
      animation: spin .7s linear infinite;
      display: inline-block;
    }
    .spinner.dark { border-color: rgba(0,0,0,.18); border-top-color: var(--ink); }
    @keyframes spin { to { transform: rotate(360deg); } }

    /* ---- Footer (matches fyzlgroup.com apps) ---- */
    .footer {
      background: var(--black);
      color: var(--white);
      text-align: center;
      margin-top: auto;
      padding: 25px 20px calc(25px + env(safe-area-inset-bottom));
      font-size: 13px;
      line-height: 1.7;
    }
    .footer .tagline { color: #c9c9c9; letter-spacing: .3px; }
    .footer .brand { font-weight: 700; letter-spacing: .5px; margin-top: 4px; }
    .footer img { height: 34px; margin-top: 14px; }
    .footer .copyright { margin-top: 14px; color: #9a9a9a; font-size: 12px; }

    @media (max-width: 640px) {
      .topbar { padding: calc(10px + env(safe-area-inset-top)) 16px 10px; }
      .topbar-brand img { width: 150px; }
      .topbar-appname { display: none; }
      main { padding: 20px 14px 50px; }
      .card { border-radius: var(--radius-md); }
      table.rows-table thead { display: none; }
      table.rows-table, table.rows-table tbody, table.rows-table tr, table.rows-table td { display: block; width: 100%; }
      table.rows-table tr { padding: 14px 16px; border-bottom: 1px solid var(--border); }
      table.rows-table td { border: none; padding: 3px 0; }
      table.rows-table td[style] { text-align: left !important; margin-top: 8px; }
      table.rows-table .btn { width: 100%; justify-content: center; }
      /* Undo the desktop fixed-width/nowrap row-actions rules above — on
         a narrow screen each button should stack full-width instead, same
         as every other .btn here. Same selectors (so same specificity),
         placed later, so these win for screens this narrow. */
      table.rows-table .row-actions { flex-wrap: wrap; }
      table.rows-table .row-actions .btn[data-clear-row],
      table.rows-table .row-actions .btn[data-conditions-row],
      table.rows-table .row-actions .btn[data-row] { width: 100%; }
      table.rows-table .row-actions .btn.invisible { display: none; }
      .modal-header, .modal-body, .modal-footer { padding-left: 18px; padding-right: 18px; }
      .loan-status-grid { grid-template-columns: 1fr; }

      /* Too narrow for 7 columns side by side — fall back to a stacked
         list, same as the client-facing Loan Status page does on mobile. */
      .loan-status-timeline { display: flex; flex-direction: column; gap: 8px; padding: 0; margin: 14px 0 4px; }
      .loan-status-timeline::before { display: none; }
      .loan-status-step {
        flex-direction: row; align-items: center; text-align: left; gap: 14px;
        padding: 10px 12px; border-radius: var(--radius-md);
        background: #fafafa; border: 1px solid var(--border);
      }
      .loan-status-step-icon { width: 34px; height: 34px; font-size: 15px; }
      .loan-status-step-title  { font-size: 13px; }
      .loan-status-step-status { font-size: 12px; margin-top: 1px; }
    }

    /* =================================================================
       VIEW ROUTER — the four "pages" this document now behaves as (see
       showView() near the bottom of the script). Only the active one is
       ever visible; the other three sit in the DOM with display:none.
       ================================================================= */
    .view-pane { display: none; }
    .view-pane.active { display: block; }

    /* =================================================================
       MISMO COMPILER (view-mismo) — folded in from the standalone
       MismoIndex.html. Its own topbar/footer are dropped (the shell
       above already provides both for every view); everything else is
       scoped under #view-mismo so its bare element selectors (button,
       input[type=text], h2...) and reused class names (.card, .label,
       .app-list...) can't leak into — or be leaked into by — the other
       views or the console's own global styles.
       ================================================================= */
    #view-mismo .container {
      flex: 1;
      width: 100%;
      max-width: 640px;
      margin: 0 auto;
      padding: 35px;
      box-sizing: border-box;
      overflow-x: hidden;
    }
    #view-mismo h2 { font-size: 28px; margin-bottom: 5px; }
    #view-mismo .mismo-back-row { margin: -6px 0 18px; }
    #view-mismo .mismo-back-btn {
      display: inline-flex; align-items: center; gap: 6px; width: auto;
      background: var(--white); color: var(--ink); border: 1px solid var(--border-strong);
      border-radius: var(--radius-sm); padding: 8px 14px; font-size: 12.5px; font-weight: 700;
      cursor: pointer; min-height: auto; font-family: inherit; transition: .2s;
    }
    #view-mismo .mismo-back-btn:hover { background: var(--black); color: var(--white); border-color: var(--black); }
    #view-mismo .card {
      background: white;
      padding: 30px;
      margin-bottom: 25px;
      border-radius: 18px;
      box-shadow: 0 10px 30px rgba(0,0,0,.08);
      transition: .25s;
      overflow-wrap: break-word;
    }
    #view-mismo .label {
      font-size: 13px;
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 1px;
      color: #777;
      margin-bottom: 6px;
    }
    #view-mismo .subtitle {
      color: #666;
      font-size: 15px;
      line-height: 1.6;
      margin-top: -5px;
      margin-bottom: 26px;
    }
    #view-mismo input[type=text] {
      width: 100%;
      padding: 16px;
      font-size: 17px;
      border: 1px solid #ddd;
      border-radius: 12px;
      background: white;
      transition: .25s;
      -webkit-appearance: none;
      appearance: none;
      margin-bottom: 18px;
      box-sizing: border-box;
    }
    #view-mismo input[type=text]:focus {
      outline: none;
      border-color: #111;
      box-shadow: 0 0 0 4px rgba(0,0,0,.08);
    }
    #view-mismo button {
      background: black;
      color: white;
      padding: 14px 28px;
      border: none;
      border-radius: 10px;
      font-size: 16px;
      font-weight: 600;
      cursor: pointer;
      transition: .25s;
      width: 100%;
      min-height: 48px;
      -webkit-appearance: none;
      appearance: none;
    }
    #view-mismo button:hover { opacity: .9; }
    #view-mismo button:disabled { cursor: not-allowed; }
    #view-mismo button.secondary { background: white; color: #111; border: 1px solid #111; }
    #view-mismo button.small { padding: 10px 20px; font-size: 13.5px; min-height: 40px; margin-top: 12px; }
    #view-mismo .app-list-wrap { margin: -8px 0 20px; }
    #view-mismo .app-list-count { font-size: 12px; color: #888; margin-bottom: 8px; }
    #view-mismo .app-list-empty { font-size: 14px; color: #888; padding: 14px 2px; }
    #view-mismo .app-list { max-height: 300px; overflow-y: auto; border: 1px solid #ddd; border-radius: 12px; }
    #view-mismo .app-row {
      width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 10px;
      padding: 14px 16px; border: none; border-bottom: 1px solid #eee; background: white;
      font-family: inherit; font-size: 14px; text-align: left; cursor: pointer; color: #111;
    }
    #view-mismo .app-row:last-child { border-bottom: none; }
    #view-mismo .app-row:hover { background: #fafafa; }
    #view-mismo .app-row-name { font-weight: 700; }
    #view-mismo .app-row-loan { color: #888; font-size: 12.5px; white-space: nowrap; }
    #view-mismo .manual-search { border-top: 1px solid #ececec; padding-top: 20px; margin-top: 6px; }
    #view-mismo .manual-search-label { font-size: 13px; color: #888; margin-bottom: 10px; }
    #view-mismo #mismo-result-card { display: none; }
    #view-mismo .applicant-name { font-size: 26px; font-weight: 700; color: #111; margin-bottom: 4px; }
    #view-mismo .applicant-sub { color: #777; font-size: 15px; margin-bottom: 22px; }
    #view-mismo .info-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; margin-bottom: 6px; }
    #view-mismo .info-box { background: #fafafa; border: 1px solid #ececec; padding: 18px 20px; border-radius: 14px; }
    #view-mismo .info-box.full { grid-column: 1/-1; }
    #view-mismo .info-title {
      font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase;
      color: #777; margin-bottom: 8px;
    }
    #view-mismo .info-value { font-size: 18px; font-weight: 600; color: #111; word-break: break-word; }
    #view-mismo .submit-section { margin-top: 28px; padding-top: 24px; border-top: 1px solid #ececec; }
    #view-mismo #mismo-status { margin-top: 14px; font-size: 13px; min-height: 16px; line-height: 1.5; }
    #view-mismo #mismo-status.error { color: #d33; font-weight: 600; }
    #view-mismo #mismo-status.ok { color: #0a7f3f; font-weight: 600; }
    #view-mismo #mismo-status.pending { color: #777; }
    @media (max-width: 1024px) {
      #view-mismo .card { border-radius: 12px; overflow-wrap: break-word; padding: 22px; }
      #view-mismo .container { padding: 50px 15px 15px; }
      #view-mismo h2 { font-size: 24px; }
      #view-mismo .applicant-name { font-size: 22px; }
      #view-mismo .info-grid { grid-template-columns: 1fr; gap: 12px; }
      #view-mismo input[type=text], #view-mismo button { min-height: 48px; font-size: 16px; }
    }

    /* =================================================================
       1003 EDITOR (view-1003editor) — folded in from Editor1003Index.html.
       Same scoping approach as Mismo above.
       ================================================================= */
    #view-1003editor main {
      flex: 1; width: 100%; max-width: 900px; margin: 0 auto; padding: 30px 24px 90px; box-sizing: border-box;
    }
    #view-1003editor .editor1003-back-row { margin: -6px 0 14px; }
    #view-1003editor h2 { font-size: 24px; margin-bottom: 6px; }
    #view-1003editor .subtitle { font-size: 13.5px; color: var(--text-muted); line-height: 1.6; margin: 0 0 18px; }
    #view-1003editor .card {
      background: var(--white); border-radius: var(--radius-lg); box-shadow: var(--shadow-card);
      padding: 24px 26px; margin-bottom: 20px;
    }
    #view-1003editor .search-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
    #view-1003editor .search-row .field-group { flex: 1; min-width: 240px; margin-bottom: 0; }
    #view-1003editor .app-list-wrap { margin: 4px 0 20px; }
    #view-1003editor .app-list-count { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
    #view-1003editor .app-list-empty { font-size: 13px; color: var(--text-muted); padding: 14px 2px; }
    #view-1003editor .app-list { max-height: 300px; overflow-y: auto; border: 1px solid var(--border-strong); border-radius: var(--radius-md); }
    #view-1003editor .app-row {
      width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 10px;
      padding: 12px 14px; border: none; border-bottom: 1px solid var(--border); background: var(--white);
      font-family: inherit; font-size: 13.5px; text-align: left; cursor: pointer; color: var(--ink);
    }
    #view-1003editor .app-row:last-child { border-bottom: none; }
    #view-1003editor .app-row:hover { background: #fafafa; }
    #view-1003editor .app-row-name { font-weight: 700; }
    #view-1003editor .app-row-loan { color: var(--text-muted); font-size: 12px; white-space: nowrap; }
    #view-1003editor .manual-search { border-top: 1px solid var(--border); padding-top: 16px; margin-top: 2px; }
    #view-1003editor .manual-search-label { font-size: 12.5px; color: var(--text-muted); margin-bottom: 10px; }
    #view-1003editor .pipeline-search { border-top: 1px solid var(--border); padding-top: 16px; margin-top: 16px; }
    #view-1003editor .pipeline-search-intro { font-size: 12.5px; color: var(--text-muted); line-height: 1.55; margin-bottom: 12px; }
    #view-1003editor .pipeline-search-intro strong { color: var(--ink); }
    #view-1003editor .pipeline-panel { margin-top: 14px; }
    #view-1003editor .pipeline-badge {
      display: inline-block; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px;
      padding: 3px 9px; border-radius: 999px; background: var(--amber-bg); color: var(--amber-text); margin-bottom: 10px;
    }
    #view-1003editor .pipeline-confirm { background: #fafafa; border: 1px solid var(--border-strong); border-radius: var(--radius-md); padding: 16px 18px; margin-top: 14px; }
    #view-1003editor .pipeline-confirm-name { font-weight: 700; font-size: 15px; margin-bottom: 6px; }
    #view-1003editor .pipeline-confirm-detail { font-size: 12.5px; color: var(--text-muted); margin-bottom: 2px; }
    #view-1003editor select, #view-1003editor input[type=text], #view-1003editor input[type=date],
    #view-1003editor input[type=email], #view-1003editor textarea {
      width: 100%; padding: 11px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-md);
      font-size: 14px; background: var(--white); font-family: inherit; min-height: 44px;
      -webkit-appearance: none; appearance: none;
    }
    #view-1003editor textarea { min-height: 110px; resize: vertical; font-family: Consolas, Menlo, monospace; font-size: 12px; }
    #view-1003editor select:focus, #view-1003editor input:focus, #view-1003editor textarea:focus { outline: none; border-color: var(--ink); box-shadow: var(--focus-ring); }
    #view-1003editor input[readonly], #view-1003editor textarea[readonly], #view-1003editor select:disabled { background: #f2f2f2; color: var(--text-muted); cursor: not-allowed; }
    #view-1003editor .field-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 0 18px; }
    #view-1003editor details.group { background: var(--white); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); margin-bottom: 14px; overflow: hidden; }
    #view-1003editor details.group > summary {
      list-style: none; cursor: pointer; padding: 16px 22px; font-weight: 700; font-size: 14.5px;
      color: var(--ink); display: flex; justify-content: space-between; align-items: center;
      background: #fafafa; border-bottom: 1px solid transparent;
    }
    #view-1003editor details.group[open] > summary { border-bottom-color: var(--border); }
    #view-1003editor details.group > summary::-webkit-details-marker { display: none; }
    #view-1003editor details.group > summary::after { content: '+'; font-size: 18px; color: var(--text-muted); font-weight: 400; }
    #view-1003editor details.group[open] > summary::after { content: '–'; }
    #view-1003editor details.group .group-body { padding: 20px 22px 4px; }
    #view-1003editor .result-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
    #view-1003editor .result-name { font-size: 19px; font-weight: 700; }
    #view-1003editor .result-sub { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }
    #view-1003editor .save-bar {
      position: sticky; bottom: 0; left: 0; right: 0; background: var(--white);
      border-top: 1px solid var(--border-strong); padding: 14px 24px calc(14px + env(safe-area-inset-bottom));
      display: flex; justify-content: flex-end; gap: 10px; box-shadow: 0 -8px 20px rgba(0,0,0,.06);
      margin: 0 -24px -90px; z-index: 5;
    }
    @media (max-width: 640px) {
      #view-1003editor main { padding: 20px 14px 90px; }
      #view-1003editor .save-bar { margin: 0 -14px -90px; padding: 14px; }
      #view-1003editor details.group .group-body { padding: 16px 14px 2px; }
    }

    /* =================================================================
       SYSTEM HEALTH (view-health) — folded in from HealthCheckIndex.html.
       Same scoping approach as the two views above.
       ================================================================= */
    #view-health main {
      flex: 1; width: 100%; max-width: 1080px; margin: 0 auto; padding: 30px 24px 60px; box-sizing: border-box;
    }
    #view-health .health-back-row { margin: -6px 0 14px; }
    #view-health h2 { font-size: 24px; margin-bottom: 6px; }
    #view-health .subtitle { font-size: 13.5px; color: var(--text-muted); line-height: 1.6; margin: 0 0 6px; }
    #view-health .generated-at { font-size: 12px; color: var(--text-faint); margin-bottom: 18px; }
    #view-health .toolbar-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
    #view-health .tabs { display: flex; gap: 6px; }
    #view-health .tab-btn { background: var(--white); border: 1px solid var(--border-strong); color: var(--text-muted); border-radius: var(--radius-sm); padding: 9px 16px; font-size: 13px; font-weight: 700; cursor: pointer; font-family: inherit; }
    #view-health .tab-btn.active { background: var(--black); color: var(--white); border-color: var(--black); }
    #view-health .health-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin-bottom: 22px; }
    #view-health .health-card { background: var(--white); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); padding: 20px 22px; display: flex; flex-direction: column; gap: 10px; }
    #view-health .health-card-title { font-size: 15.5px; font-weight: 700; color: var(--ink); }
    #view-health .health-card-desc { font-size: 12px; color: var(--text-muted); line-height: 1.5; min-height: 34px; }
    #view-health .health-status-row { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; }
    #view-health .health-status-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
    #view-health .health-status-dot.red   { background: #dc3545; }
    #view-health .health-status-dot.amber { background: #f0ad4e; }
    #view-health .health-status-dot.green { background: #28a745; }
    #view-health .health-status-dot.gray  { background: #adb5bd; }
    #view-health .health-status-label.red   { color: #a71d2a; }
    #view-health .health-status-label.amber { color: var(--amber-text); }
    #view-health .health-status-label.green { color: var(--green-text); }
    #view-health .health-status-label.gray  { color: var(--text-faint); }
    #view-health .health-stats-row { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-muted); }
    #view-health .health-stats-row b { color: var(--ink); }
    #view-health .health-backlog-note { font-size: 11.5px; color: var(--amber-text); background: var(--amber-bg); border-radius: var(--radius-sm); padding: 7px 10px; line-height: 1.4; }
    #view-health .health-backlog-note.red-note { color: var(--red-text); background: var(--red-bg); }
    #view-health .pill-error  { background: var(--red-bg);    color: var(--red-text); }
    #view-health .pill-warn   { background: var(--amber-bg);  color: var(--amber-text); }
    #view-health .pill-info   { background: var(--gray-bg);   color: var(--gray-text2); }
    #view-health .pill-review { background: var(--purple-bg); color: var(--purple-text); }
    #view-health .pill { text-transform: uppercase; padding: 3px 10px; font-size: 10.5px; }
    #view-health .event-list { display: flex; flex-direction: column; gap: 10px; }
    #view-health .event-row { border: 1px solid var(--border); border-radius: var(--radius-md); padding: 12px 14px; background: #fafafa; }
    #view-health .event-row-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 5px; flex-wrap: wrap; }
    #view-health .event-row-meta { font-size: 11px; color: var(--text-faint); }
    #view-health .event-row-message { font-size: 13px; color: var(--ink); line-height: 1.5; }
    #view-health .event-row-system { font-size: 10.5px; color: var(--text-muted); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
    #view-health .event-row-actions { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
    #view-health .event-context {
      margin-top: 8px; font-size: 11.5px; color: var(--text-muted); background: var(--white);
      border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px;
      font-family: Consolas, Menlo, monospace; white-space: pre-wrap; word-break: break-word; max-height: 160px; overflow-y: auto;
    }
    #view-health .known-issue-box {
      margin-top: 8px; background: #fffaf0; border: 1px solid #f0dfb8; border-radius: var(--radius-sm);
      padding: 10px 12px; font-size: 12px; color: var(--text); line-height: 1.55;
    }
    #view-health .known-issue-box .kib-title { font-weight: 700; color: var(--ink); margin-bottom: 3px; }
    #view-health .known-issue-box .kib-fix { margin-top: 5px; }
    #view-health .known-issue-box .kib-fix b { color: var(--ink); }
    #view-health .ai-explain-box {
      margin-top: 8px; background: #f5f3ff; border: 1px solid #ddd4f7; border-radius: var(--radius-sm);
      padding: 10px 12px; font-size: 12px; color: var(--text); line-height: 1.55; white-space: pre-wrap;
    }
    #view-health .filters-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
    #view-health .filters-row input, #view-health .filters-row select {
      padding: 9px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-md);
      font-size: 13px; background: var(--white); font-family: inherit; min-height: 40px;
    }
    #view-health .filters-row input { flex: 1; min-width: 200px; }
    #view-health .activity-count { font-size: 12px; color: var(--text-muted); margin-bottom: 10px; }
    @media (max-width: 640px) {
      #view-health main { padding: 20px 14px 50px; }
    }

    /* ================================================================
       DEV MODE / AUTOCOMMAND MAKER (view-devmode) — Phase 5. Owner/Admin
       only. Lets an admin create new email-only Auto Commands (trigger,
       recipient rule, subject/body template, optional form fields) with
       no code changes — see AutoCommandExecutionPhase5.gs for the server
       side. This view only manages the DEFINITIONS; actually running one
       still goes through the existing "Run a Command" dialog in the
       console view, unchanged.
       ================================================================ */
    #view-devmode .back-row { margin: -6px 0 14px; }
    #view-devmode h2 { font-size: 24px; margin-bottom: 6px; }
    #view-devmode .subtitle { font-size: 13.5px; color: var(--text-muted); line-height: 1.6; margin: 0 0 18px; }
    #view-devmode .dm-toolbar { display: flex; justify-content: flex-end; margin-bottom: 16px; }
    #view-devmode .dm-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }
    #view-devmode .dm-row {
      background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-md);
      padding: 14px 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
    }
    #view-devmode .dm-row-main { min-width: 220px; }
    #view-devmode .dm-row-label { font-size: 14.5px; font-weight: 700; color: var(--ink); }
    #view-devmode .dm-row-meta { font-size: 12px; color: var(--text-faint); margin-top: 3px; }
    #view-devmode .dm-row-actions { display: flex; gap: 8px; flex-wrap: wrap; }
    #view-devmode .dm-pill { text-transform: uppercase; font-size: 10.5px; font-weight: 700; padding: 3px 10px; border-radius: 20px; letter-spacing: .03em; }
    #view-devmode .dm-pill.active { background: var(--green-bg); color: var(--green-text); }
    #view-devmode .dm-pill.disabled { background: var(--gray-bg); color: var(--gray-text2); }
    #view-devmode .dm-empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); font-size: 13.5px; }
    #view-devmode .dm-editor-card {
      background: var(--white); border-radius: var(--radius-lg); box-shadow: var(--shadow-card);
      padding: 24px 26px; margin-bottom: 30px;
    }
    #view-devmode .dm-editor-card h3 { font-size: 17px; margin-bottom: 4px; }
    #view-devmode .dm-editor-sub { font-size: 12.5px; color: var(--text-muted); margin-bottom: 18px; line-height: 1.5; }
    #view-devmode .dm-section-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); margin: 22px 0 10px; }
    #view-devmode textarea {
      width: 100%; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-md);
      font-size: 13.5px; font-family: inherit; min-height: 90px; resize: vertical; background: var(--white);
    }
    #view-devmode textarea:focus, #view-devmode input:focus, #view-devmode select:focus {
      outline: none; box-shadow: var(--focus-ring); border-color: var(--border-strong);
    }
    #view-devmode .dm-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
    #view-devmode .dm-recipient-row { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 4px; }
    #view-devmode .dm-recipient-option { display: flex; align-items: center; gap: 7px; font-size: 13.5px; }
    #view-devmode .dm-token-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 10px; }
    #view-devmode .dm-chip {
      font-size: 11px; font-weight: 700; background: var(--bg); border: 1px solid var(--border-strong);
      border-radius: 20px; padding: 4px 10px; cursor: pointer; font-family: inherit; color: var(--text);
    }
    #view-devmode .dm-chip:hover { background: var(--black); color: var(--white); border-color: var(--black); }
    #view-devmode .dm-chip-search { background: #eef1f4; border-style: dashed; }
    #view-devmode .dm-field-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
    #view-devmode .dm-field-row {
      border: 1px solid var(--border); border-radius: var(--radius-md); padding: 12px 14px; background: #fafafa;
    }
    #view-devmode .dm-field-row-top { display: grid; grid-template-columns: 2fr 1fr auto auto; gap: 10px; align-items: center; }
    #view-devmode .dm-pm-row-top { display: grid; grid-template-columns: 160px 1fr auto; gap: 10px; align-items: center; }
    #view-devmode .dm-field-row-second { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
    #view-devmode .dm-field-options { margin-top: 10px; }
    #view-devmode .dm-field-remove {
      background: none; border: none; color: var(--red-text); font-size: 18px; cursor: pointer; line-height: 1;
      padding: 4px 8px;
    }
    #view-devmode .dm-required-badge { color: var(--red-text); }
    #view-devmode .dm-style-row { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 4px; }
    #view-devmode .dm-style-option { display: flex; align-items: center; gap: 7px; font-size: 13.5px; }
    #view-devmode .dm-body-toolbar { display: flex; gap: 8px; margin: 8px 0 10px; }
    #view-devmode .dm-image-status { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }
    #view-devmode .dm-file-status { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-muted); margin-bottom: 4px; }
    #view-devmode code { background: var(--bg); border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; font-size: 11.5px; }
    /* Choice cards — the big-card picker used for Command Type ("Custom
       Email" / "Generate File"), Document source ("Upload" / "Build It
       Here"), and Recipient ("The Client" / "One Fixed Address" / "Ask Me
       Each Time"), plus the contextual "Also Cc the Client" checkbox shown
       under the latter two recipient choices. */
    #view-devmode .dm-choice-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; margin-bottom: 4px; }
    #view-devmode .dm-choice-card {
      position: relative; display: flex; flex-direction: column; gap: 4px;
      border: 1.5px solid var(--border-strong); border-radius: var(--radius-md);
      padding: 14px 30px 12px 14px; cursor: pointer; background: var(--white);
      transition: border-color .12s, box-shadow .12s, background .12s;
    }
    #view-devmode .dm-choice-card input[type="radio"] {
      position: absolute; top: 13px; right: 12px; width: 16px; height: 16px; accent-color: var(--accent); margin: 0;
    }
    #view-devmode .dm-choice-card:hover { border-color: var(--accent); }
    #view-devmode .dm-choice-card.selected,
    #view-devmode .dm-choice-card:has(input:checked) {
      border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); background: var(--accent-bg);
    }
    #view-devmode .dm-choice-card-icon { font-size: 17px; line-height: 1; }
    #view-devmode .dm-choice-card-title { font-size: 13.5px; font-weight: 700; color: var(--ink); }
    #view-devmode .dm-choice-card-desc { font-size: 11.5px; color: var(--text-muted); line-height: 1.4; }
    #view-devmode .dm-cc-checkbox {
      display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); width: fit-content;
      background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-md);
      padding: 9px 12px; margin: 10px 0 4px; cursor: pointer;
    }
    #view-devmode .dm-cc-checkbox input { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; }
    /* Step-by-step wizard chrome — progress stepper, per-step body, and the
       Back/Continue (or Preview/Save on the last step) footer. */
    #view-devmode .dm-stepper { display: flex; align-items: flex-start; gap: 0; margin: 4px 0 24px; overflow-x: auto; }
    #view-devmode .dm-step-item {
      display: flex; flex-direction: column; align-items: center; gap: 6px; background: none; border: none; cursor: pointer;
      padding: 4px 8px; font-family: inherit; flex: 0 0 auto; min-width: 70px;
    }
    #view-devmode .dm-step-dot {
      width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
      font-size: 12px; font-weight: 700; border: 1.5px solid var(--border-strong); background: var(--white); color: var(--text-muted);
      transition: border-color .12s, background .12s, color .12s;
    }
    #view-devmode .dm-step-item.current .dm-step-dot { border-color: var(--accent); background: var(--accent); color: var(--white); }
    #view-devmode .dm-step-item.done .dm-step-dot { border-color: var(--accent); background: var(--accent-bg); color: var(--accent); }
    #view-devmode .dm-step-label { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--text-faint); white-space: nowrap; }
    #view-devmode .dm-step-item.current .dm-step-label { color: var(--ink); }
    /* A step past whatever's been validated so far isn't reachable yet —
       see state.furthestWizardStepIndex. Still a real <button> (so it's
       keyboard-focusable and screen readers see aria-disabled), just
       visibly and functionally inert. */
    #view-devmode .dm-step-item.locked { cursor: not-allowed; opacity: .45; }
    #view-devmode .dm-step-connector { flex: 1 1 20px; height: 1.5px; background: var(--border-strong); margin-top: 13px; min-width: 16px; }
    #view-devmode .dm-wizard-step-body { min-height: 100px; }
    #view-devmode .dm-wizard-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 26px; align-items: center; }
    #view-devmode .dm-wizard-footer .dm-footer-spacer { flex: 1; }
    #view-devmode .dm-review-list { border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; margin-bottom: 16px; }
    #view-devmode .dm-review-row { display: flex; gap: 14px; padding: 10px 14px; font-size: 13px; }
    #view-devmode .dm-review-row + .dm-review-row { border-top: 1px solid var(--border); }
    #view-devmode .dm-review-label { flex: 0 0 150px; font-weight: 700; color: var(--text-muted); }
    #view-devmode .dm-review-value { flex: 1; color: var(--ink); word-break: break-word; }
    /* Rich-text Message editor — Bold/Italic/Underline/Bullet-list toolbar
       over a contenteditable box, replacing the old plain <textarea>. */
    #view-devmode .dm-richtext-toolbar { display: flex; align-items: center; gap: 4px; margin: 8px 0 0; flex-wrap: wrap; }
    #view-devmode .dm-rt-btn {
      min-width: 30px; height: 30px; padding: 0 9px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
      background: var(--white); cursor: pointer; font-size: 12.5px; font-family: inherit; color: var(--text); line-height: 1;
    }
    #view-devmode .dm-rt-btn:hover { background: var(--bg); border-color: var(--accent); }
    #view-devmode .dm-rt-sep { width: 1px; height: 20px; background: var(--border-strong); margin: 0 4px; }
    #view-devmode .dm-richtext-body {
      width: 100%; min-height: 160px; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-md);
      font-size: 13.5px; font-family: inherit; background: var(--white); line-height: 1.55; white-space: pre-wrap; overflow-wrap: break-word;
    }
    #view-devmode .dm-richtext-body:focus { outline: none; box-shadow: var(--focus-ring); border-color: var(--border-strong); }
    #view-devmode .dm-richtext-body:empty:before { content: attr(data-placeholder); color: var(--text-faint); white-space: pre-wrap; }
    #view-devmode .dm-richtext-body ul, #view-devmode .dm-richtext-body ol { margin: 8px 0; padding-left: 22px; }
    #view-devmode .dm-richtext-body p, #view-devmode .dm-richtext-body div { margin: 0 0 8px; }
    #dm-preview-modal { max-width: 720px; }
    #dm-preview-modal .dm-preview-frame-wrap {
      border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; background: #eef1f4;
    }
    #dm-preview-modal iframe { width: 100%; height: 60vh; border: 0; display: block; background: #fff; }
    #dm-colsearch-modal .dm-colsearch-results { display: flex; flex-wrap: wrap; gap: 6px; max-height: 320px; overflow-y: auto; }
    @media (max-width: 640px) {
      #view-devmode main { padding: 20px 14px 50px; }
      #view-devmode .dm-two-col, #view-devmode .dm-field-row-second { grid-template-columns: 1fr; }
      #view-devmode .dm-field-row-top { grid-template-columns: 1fr 1fr; }
      #view-devmode .dm-pm-row-top { grid-template-columns: 1fr; }
      #view-devmode .dm-choice-cards { grid-template-columns: 1fr; }
    }
  