  :root {
    --white: #ffffff;
    --ink: #0f1c17;
    --mut: #58695f;
    --soft: #8fa198;
    --line: #e9efec;
    --line-2: #d9e4df;
    --mint: #f0f8f5;
    --mint-2: #e5f3ee;
    --teal: #0d9488;
    --teal-deep: #0b6d64;
    --teal-ink: #094f48;
    --grad: linear-gradient(120deg, #0b7c72, #34b3a0);
    --green: #0a6e42;   --green-soft: #e3f5ec;
    --amber: #8f5c06;   --amber-soft: #fdf3dd;
    --red: #b3372e;     --red-soft: #fbeae8;
    --blue: #1c5cab;    --blue-soft: #e4eefb;
    --violet: #5b45b0;  --violet-soft: #ece7fb;
    --sans: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    --mono: 'Spline Sans Mono', ui-monospace, Consolas, monospace;
    --sh: 0 18px 44px -18px rgba(15, 28, 23, 0.16), 0 2px 8px -2px rgba(15, 28, 23, 0.06);
    --sh-sm: 0 8px 22px -12px rgba(15, 28, 23, 0.18);
    --sh-teal: 0 14px 30px -14px rgba(13, 148, 136, 0.5);
    --r: 16px;
    --r-sm: 14px;
    --r-lg: 18px;
  }
  * { box-sizing: border-box; margin: 0; }
  html { height: 100%; }
  body {
    min-height: 100%;
    background: var(--white);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 14.5px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
  }
  svg { display: block; }
  a { color: var(--teal-deep); text-decoration: none; }
  a:hover { text-decoration: underline; }
  button, input, select, textarea { font: inherit; color: inherit; }
  button { cursor: pointer; }
  :focus-visible { outline: 2px solid var(--teal-deep); outline-offset: 2px; border-radius: 6px; }
  ::placeholder { color: var(--soft); }

  /* ---------------- shell layout ---------------- */
  .app { display: flex; min-height: 100vh; }
  .side {
    width: 224px; flex-shrink: 0;
    position: sticky; top: 0; align-self: flex-start;
    height: 100vh;
    display: flex; flex-direction: column; gap: 6px;
    padding: 22px 14px 18px;
    border-right: 1px solid var(--line);
    background: linear-gradient(180deg, #ffffff, #f7fbf9);
  }
  .brand { display: flex; align-items: center; gap: 9px; padding: 2px 8px 16px; }
  .logo-mark { width: 26px; height: 26px; flex-shrink: 0; }
  .wordmark { font-size: 18px; font-weight: 800; letter-spacing: -0.04em; line-height: 1; }
  .wordmark em {
    font-style: normal;
    background: var(--grad);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
  }
  .side-tag {
    font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em;
    text-transform: uppercase; color: var(--soft);
    padding: 0 8px 12px;
  }
  .nav { display: grid; gap: 4px; }
  .nav button {
    display: flex; align-items: center; gap: 10px;
    width: 100%; text-align: left;
    padding: 9px 12px; border-radius: 999px;
    border: 1px solid transparent; background: transparent;
    font-weight: 600; font-size: 13.5px; color: var(--mut);
    transition: background 0.12s ease, color 0.12s ease;
  }
  .nav button svg { width: 16px; height: 16px; flex-shrink: 0; }
  .nav button:hover { background: var(--mint); color: var(--ink); }
  .nav button.on {
    background: var(--mint); color: var(--teal-ink);
    border-color: var(--line-2);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.8);
  }
  .side-foot { margin-top: auto; display: grid; gap: 10px; padding: 0 4px; }
  .lock-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 8px 14px; border-radius: 999px;
    border: 1px solid var(--line-2); background: #fff;
    font-weight: 600; font-size: 12.5px; color: var(--mut);
  }
  .lock-btn:hover { border-color: var(--ink); color: var(--ink); }
  .side-c { font-family: var(--mono); font-size: 10px; color: var(--soft); text-align: center; }

  .main { flex: 1; min-width: 0; padding: 34px 38px 64px; max-width: 1160px; }

  /* ---------------- view chrome ---------------- */
  .view { display: none; }
  .view.on { display: block; animation: fadeUp 0.28s ease both; }
  @keyframes fadeUp { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }
  @media (prefers-reduced-motion: reduce) { .view.on { animation: none; } }

  .vhead { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
  .vhead h1 { font-size: 25px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; }
  .vhead .sub { color: var(--mut); font-size: 13.5px; margin-top: 4px; }
  .vhead .spacer { flex: 1; }

  /* ---------------- buttons / inputs ---------------- */
  .btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 20px; border-radius: 999px;
    font-weight: 700; font-size: 13.5px;
    border: 1px solid transparent;
    transition: transform 0.14s ease, box-shadow 0.14s ease;
    white-space: nowrap;
  }
  .btn:hover { transform: translateY(-1px); }
  .btn:disabled { opacity: 0.55; cursor: default; transform: none; }
  .btn-teal { background: linear-gradient(120deg, #0b7c72, #0a6b62); color: #fff; box-shadow: var(--sh-teal); }
  .btn-line { border-color: var(--line-2); background: #fff; color: var(--ink); }
  .btn-line:hover { border-color: var(--ink); }
  .btn-ghost { background: transparent; color: var(--mut); padding: 8px 14px; font-size: 12.5px; }
  .btn-ghost:hover { color: var(--ink); background: var(--mint); }
  .btn-sm { padding: 6px 13px; font-size: 12px; }

  label.f { display: grid; gap: 5px; font-size: 12px; font-weight: 600; color: var(--mut); }
  .in, select.in, textarea.in {
    width: 100%;
    padding: 9px 13px; border-radius: 12px;
    border: 1px solid var(--line-2); background: #fff;
    font-size: 13.5px; font-weight: 500; color: var(--ink);
    transition: border-color 0.12s ease, box-shadow 0.12s ease;
  }
  .in:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.14); }
  textarea.in { resize: vertical; min-height: 64px; }
  select.in { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2358695f' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; background-size: 14px; padding-right: 32px; }
  .check { display: flex; align-items: center; gap: 9px; font-size: 13px; font-weight: 600; color: var(--ink); cursor: pointer; }
  .check input { width: 16px; height: 16px; accent-color: var(--teal); cursor: pointer; }

  /* ---------------- cards ---------------- */
  .card {
    background: #fff;
    border: 1px solid var(--line-2);
    border-radius: var(--r-lg);
    box-shadow: var(--sh-sm);
  }
  .card-h {
    display: flex; align-items: center; gap: 12px;
    padding: 15px 20px; border-bottom: 1px solid var(--line);
  }
  .card-h h2 { font-size: 14.5px; font-weight: 700; letter-spacing: -0.01em; }
  .card-h .hint { font-size: 12px; color: var(--soft); }
  .card-h .end { margin-left: auto; display: flex; align-items: center; gap: 8px; }
  .card-b { padding: 20px; }
  .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }

  /* ---------------- stat tiles ---------------- */
  .stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 22px; }
  .stat {
    background: #fff; border: 1px solid var(--line-2); border-radius: var(--r);
    box-shadow: var(--sh-sm);
    padding: 16px 18px 14px;
    position: relative; overflow: hidden;
  }
  .stat::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--grad); opacity: 0.9; }
  .stat .l { font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--mut); }
  .stat .v { font-size: 25px; font-weight: 800; letter-spacing: -0.03em; margin-top: 5px; font-variant-numeric: tabular-nums; }
  .stat .v.money { font-size: 22px; }

  /* ---------------- tables ---------------- */
  .tbl-wrap { overflow-x: auto; }
  table { width: 100%; border-collapse: collapse; font-size: 13px; }
  th {
    text-align: left; font-family: var(--mono); font-size: 10px; font-weight: 500;
    letter-spacing: 0.09em; text-transform: uppercase; color: var(--soft);
    padding: 11px 20px; border-bottom: 1px solid var(--line);
    white-space: nowrap;
  }
  td { padding: 11px 20px; border-bottom: 1px solid var(--line); vertical-align: middle; }
  tr:last-child td { border-bottom: none; }
  tbody tr { transition: background 0.1s ease; }
  tbody tr:hover { background: #fafdfc; }
  td .b { font-weight: 600; }
  td .dim { color: var(--mut); font-size: 12.5px; }
  .num { font-family: var(--mono); font-size: 12.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }

  .pcell { display: flex; align-items: center; gap: 10px; min-width: 0; }
  .pip {
    width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
    color: #fff; font-size: 10px; font-weight: 700;
    display: grid; place-items: center; letter-spacing: 0.02em;
  }
  .pcell .pl { min-width: 0; }
  .pcell .pl .n { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .pcell .pl .s { font-size: 11.5px; color: var(--mut); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  /* ---------------- chips / badges ---------------- */
  .chip {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 10.5px; font-weight: 700; letter-spacing: 0.02em;
    padding: 3px 10px; border-radius: 999px; white-space: nowrap;
  }
  .chip i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
  .c-green { background: var(--green-soft); color: var(--green); }
  .c-amber { background: var(--amber-soft); color: var(--amber); }
  .c-red   { background: var(--red-soft); color: var(--red); }
  .c-blue  { background: var(--blue-soft); color: var(--blue); }
  .c-violet{ background: var(--violet-soft); color: var(--violet); }
  .c-gray  { background: var(--mint); color: var(--mut); }
  .c-teal  { background: var(--mint-2); color: var(--teal-ink); }

  /* ---------------- loading / empty / error ---------------- */
  .skel { display: grid; gap: 10px; padding: 20px; }
  .skel i {
    display: block; height: 14px; border-radius: 7px;
    background: linear-gradient(90deg, var(--mint) 25%, var(--mint-2) 45%, var(--mint) 65%);
    background-size: 240% 100%;
    animation: shimmer 1.2s linear infinite;
  }
  .skel i:nth-child(2) { width: 82%; } .skel i:nth-child(3) { width: 64%; } .skel i:nth-child(4) { width: 90%; }
  @keyframes shimmer { from { background-position: 130% 0; } to { background-position: -110% 0; } }
  @media (prefers-reduced-motion: reduce) { .skel i { animation: none; } }
  .empty { padding: 38px 20px; text-align: center; color: var(--mut); font-size: 13px; }
  .empty .glyph {
    width: 40px; height: 40px; margin: 0 auto 10px; border-radius: 13px;
    background: var(--mint); border: 1px solid var(--line-2);
    display: grid; place-items: center; color: var(--teal-deep); font-size: 17px;
  }
  .err-box {
    margin: 16px 20px; padding: 12px 16px; border-radius: var(--r-sm);
    background: var(--red-soft); color: var(--red);
    font-size: 12.5px; font-weight: 600;
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  }
  .err-box .btn { border-color: rgba(179,55,46,0.3); color: var(--red); background: #fff; }

  /* Backup warnings. Loud on purpose: "no off-box destination configured" means
     losing this server loses every customer's HR records, and that must not read
     as a hint tucked into a corner. */
  .warn-box {
    margin: 0 0 18px; padding: 14px 16px; border-radius: var(--r-sm);
    background: var(--amber-soft); color: var(--amber);
    border: 1px solid rgba(185,119,8,0.28);
    font-size: 12.5px; font-weight: 600;
  }
  .warn-box.bad { background: var(--red-soft); color: var(--red); border-color: rgba(179,55,46,0.3); }
  .warn-box .wh { display: flex; align-items: center; gap: 8px; font-size: 13px; }
  .warn-box ul { margin: 8px 0 0; padding-left: 22px; }
  .warn-box li { margin-top: 4px; line-height: 1.45; font-weight: 500; }

  .spin {
    width: 14px; height: 14px; border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.4); border-top-color: #fff;
    animation: spin 0.7s linear infinite; flex-shrink: 0;
  }
  .spin.dark { border-color: var(--line-2); border-top-color: var(--teal); }
  @keyframes spin { to { transform: rotate(360deg); } }

  /* ---------------- toasts ---------------- */
  #toasts {
    position: fixed; right: 20px; bottom: 20px; z-index: 200;
    display: grid; gap: 10px; justify-items: end;
    pointer-events: none;
  }
  .toast {
    pointer-events: auto;
    display: flex; align-items: center; gap: 10px;
    max-width: 380px;
    background: var(--ink); color: #fff;
    padding: 11px 18px; border-radius: 999px;
    font-size: 13px; font-weight: 600;
    box-shadow: var(--sh);
    animation: toastIn 0.24s ease both;
  }
  .toast.out { animation: toastOut 0.24s ease both; }
  .toast .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: #34b3a0; }
  .toast.error .dot { background: #f08c82; }
  @keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
  @keyframes toastOut { from { opacity: 1; } to { opacity: 0; transform: translateY(6px); } }

  /* ---------------- overview ---------------- */
  .row-list { display: grid; }
  .row-item { display: flex; align-items: center; gap: 12px; padding: 11px 20px; border-bottom: 1px solid var(--line); }
  .row-item:last-child { border-bottom: none; }
  .row-item .end { margin-left: auto; text-align: right; flex-shrink: 0; }

  /* ---------------- invoices ---------------- */
  .inv-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); gap: 20px; align-items: start; margin-bottom: 22px; }
  .fgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
  .fgrid .w { grid-column: 1 / -1; }
  .fsec {
    font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
    color: var(--soft); grid-column: 1 / -1; padding-top: 6px;
  }
  .fsec:first-child { padding-top: 0; }
  .total-prev {
    background: var(--mint); border: 1px solid var(--line-2); border-radius: var(--r-sm);
    padding: 14px 16px; display: grid; gap: 7px;
    font-size: 12.5px;
  }
  .tp-row { display: flex; justify-content: space-between; gap: 12px; color: var(--mut); }
  .tp-row .num { color: var(--ink); }
  .tp-row.min { color: var(--amber); font-weight: 600; }
  .tp-total {
    display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
    border-top: 1px dashed var(--line-2); padding-top: 9px; margin-top: 2px;
    font-weight: 700; font-size: 13px;
  }
  .tp-total b { font-size: 21px; font-weight: 800; letter-spacing: -0.02em; color: var(--teal-ink); font-variant-numeric: tabular-nums; }

  /* ---------------- email ---------------- */
  .flash { font-size: 12.5px; font-weight: 700; opacity: 0; transition: opacity 0.2s ease; }
  .flash.show { opacity: 1; }
  .flash.ok { color: var(--green); }
  .flash.bad { color: var(--red); }
  .tpl-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
  .tpl-tabs button {
    padding: 6px 14px; border-radius: 999px;
    border: 1px solid var(--line-2); background: #fff;
    font-size: 12px; font-weight: 700; color: var(--mut);
  }
  .tpl-tabs button:hover { color: var(--ink); }
  .tpl-tabs button.on { background: var(--mint); border-color: var(--teal); color: var(--teal-ink); }
  .tpl-frame {
    width: 100%; height: 460px; border: 1px solid var(--line-2); border-radius: var(--r-sm);
    background: #fff; margin-top: 14px;
  }
  .tpl-load { display: flex; align-items: center; gap: 9px; color: var(--mut); font-size: 12.5px; margin-top: 14px; }

  /* ---------------- system ---------------- */
  .health-dot { width: 11px; height: 11px; border-radius: 50%; flex-shrink: 0; }
  .health-dot.ok { background: #16a34a; box-shadow: 0 0 0 4px var(--green-soft); }
  .health-dot.bad { background: #dc2626; box-shadow: 0 0 0 4px var(--red-soft); }
  .kv { display: grid; gap: 0; }
  .kv .r { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
  .kv .r:last-child { border-bottom: none; }
  .kv .r span:first-child { color: var(--mut); }
  .code {
    font-family: var(--mono); font-size: 12px; line-height: 1.8;
    background: #0f1c17; color: #d7e7e0;
    border-radius: var(--r-sm); padding: 14px 18px;
    overflow-x: auto; white-space: pre;
  }
  .code .cm { color: #7d968b; }
  .code .hl { color: #6fd3c3; }
  ol.steps { padding-left: 18px; display: grid; gap: 12px; color: var(--mut); font-size: 13px; }
  ol.steps b { color: var(--ink); }
  .note-ico { width: 34px; height: 34px; border-radius: 11px; background: var(--mint); border: 1px solid var(--line-2); display: grid; place-items: center; color: var(--teal-deep); flex-shrink: 0; }

  /* ---------------- login overlay ---------------- */
  #gate {
    position: fixed; inset: 0; z-index: 100;
    display: none; align-items: center; justify-content: center;
    padding: 24px;
    background:
      radial-gradient(700px 420px at 12% -8%, rgba(13, 148, 136, 0.1), transparent 62%),
      radial-gradient(640px 420px at 96% 108%, rgba(52, 179, 160, 0.12), transparent 60%),
      #ffffff;
  }
  #gate.on { display: flex; }
  .gate-card {
    width: 100%; max-width: 384px;
    background: #fff; border: 1px solid var(--line-2); border-radius: 22px;
    box-shadow: var(--sh);
    padding: 34px 32px 30px;
    text-align: center;
  }
  .gate-card .logo-mark { width: 44px; height: 44px; margin: 0 auto 14px; }
  .gate-card h1 { font-size: 20px; font-weight: 800; letter-spacing: -0.03em; }
  .gate-card .wordmark { font-size: 20px; }
  .gate-sub { color: var(--mut); font-size: 13px; margin: 8px 0 22px; }
  .gate-card form { display: grid; gap: 12px; text-align: left; }
  .gate-err { color: var(--red); font-size: 12.5px; font-weight: 600; min-height: 18px; text-align: center; }
  .gate-foot { margin-top: 20px; font-family: var(--mono); font-size: 10.5px; color: var(--soft); }

  /* ---------------- responsive ---------------- */
  @media (max-width: 980px) {
    .grid2, .inv-grid { grid-template-columns: 1fr; }
  }
  @media (max-width: 820px) {
    .app { flex-direction: column; }
    .side {
      position: static; width: 100%; height: auto;
      flex-direction: row; align-items: center; flex-wrap: wrap; gap: 8px;
      padding: 12px 16px;
      border-right: none; border-bottom: 1px solid var(--line);
    }
    .brand { padding: 0 6px 0 0; }
    .side-tag, .side-c { display: none; }
    .nav { display: flex; flex-wrap: wrap; gap: 4px; }
    .nav button { width: auto; padding: 7px 13px; font-size: 12.5px; }
    .nav button svg { display: none; }
    .side-foot { margin: 0 0 0 auto; }
    .main { padding: 22px 16px 56px; }
    th, td { padding: 10px 14px; }
    .fgrid { grid-template-columns: 1fr; }
    .card-h .hint { display: none; }
  }

  /* ================================================================
     CSP: classes that replace inline style attributes
     ----------------------------------------------------------------
     style-src 'self' blocks a style="" attribute wherever it is parsed
     from markup, and this page builds most of its DOM with innerHTML.
     Everything that used to be an inline declaration lives here.
     ================================================================ */

  .w-260 { max-width: 260px; }
  .mb-10 { margin-bottom: 10px; }
  .mb-12 { margin-bottom: 12px; }
  .mb-18 { margin-bottom: 18px; }
  .mb-20 { margin-bottom: 20px; }
  .mt-8 { margin-top: 8px; }
  .stack-20 { display: grid; gap: 20px; }
  .hstack-12 { display: flex; align-items: center; gap: 12px; }
  .media { display: flex; gap: 14px; align-items: flex-start; }
  .chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
  .inline-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
  .grow { flex: 1; min-width: 180px; }
  .basis-full { flex-basis: 100%; }
  .span-1 { grid-column: span 1; }
  .strong { font-weight: 700; }
  .b-ink { color: var(--ink); }
  .b-sm { font-size: 12.5px; }
  .s-sm { font-size: 11.5px; color: var(--mut); }
  .p-mut { color: var(--mut); font-size: 13px; }
  .p-dim { color: var(--mut); font-size: 12.5px; }
  .note-sm { font-size: 11.5px; color: var(--soft); margin-top: 12px; }
  .err-line { color: var(--red); font-size: 11.5px; }
  .form-actions { display: flex; align-items: center; gap: 12px; padding-top: 4px; flex-wrap: wrap; }
  .form-actions.tight { padding-top: 2px; }
  .card-sep { border-top: 1px solid var(--line); margin: 18px -20px 0; padding: 16px 20px 0; }
  .sec-label {
    font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em;
    text-transform: uppercase; color: var(--soft); margin-bottom: 10px;
  }
  /* Off-screen but still selectable — the clipboard fallback needs a real,
     focusable textarea, so this cannot be display:none. */
  .offscreen { position: fixed; top: -1000px; left: -1000px; opacity: 0; }

  /* The eight avatar-pip colours, as classes rather than a computed
     background: see pipClass() in admin.js. */
  .pip-0 { background: #0d9488; } .pip-1 { background: #2a78d6; }
  .pip-2 { background: #c05b3c; } .pip-3 { background: #7c5cd6; }
  .pip-4 { background: #b97708; } .pip-5 { background: #0a6e42; }
  .pip-6 { background: #b3372e; } .pip-7 { background: #1c5cab; }

  /* ---------------- credentials ---------------- */

  /* The security note is the one thing on this screen that must not be
     dismissible, collapsible or a tooltip: it is the disclosure that the admin
     key is now worth more than it was. It sits at the top, open, always. */
  .sec-note { border-color: var(--teal); box-shadow: var(--sh-sm), inset 3px 0 0 var(--teal); }
  .sec-points { margin: 0; padding-left: 20px; display: grid; gap: 9px; }
  .sec-points li { font-size: 13px; line-height: 1.55; color: var(--mut); }
  .sec-points li::marker { color: var(--teal); }

  .cred-blurb { font-size: 13px; color: var(--mut); margin-bottom: 18px; line-height: 1.55; }
  .cred-list { display: grid; gap: 4px; }

  .cred { padding: 15px 0; border-bottom: 1px solid var(--line); }
  .cred:first-child { padding-top: 0; }
  .cred:last-child { border-bottom: none; }
  .cred-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 7px; }
  .cred-label { font-size: 12.5px; font-weight: 700; color: var(--ink); }
  .cred-hintv { font-family: var(--mono); font-size: 11px; color: var(--soft); }
  .cred .in:disabled { background: var(--mint); color: var(--mut); cursor: not-allowed; }

  .cred-help { font-size: 12px; color: var(--mut); line-height: 1.5; margin-top: 7px; }
  .cred-env {
    margin-top: 7px; padding: 7px 11px; border-radius: 10px;
    background: var(--blue-soft); color: var(--blue);
    font-size: 11.5px; font-weight: 600; line-height: 1.45;
  }
  .cred-env.warn { background: var(--amber-soft); color: var(--amber); }
  .cred-meta {
    margin-top: 7px; display: flex; flex-wrap: wrap; gap: 14px;
    font-size: 11px; color: var(--soft);
  }
  .cred-meta code { font-family: var(--mono); font-size: 11px; color: var(--mut); }
  .cred-acts { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }
  .cred-err { color: var(--red); font-size: 12px; font-weight: 600; line-height: 1.45; }
  .cred-err:not(:empty) { margin-top: 8px; }
  .cred-out:not(:empty) { margin-top: 10px; }

  .cred-refusal {
    margin-top: 14px; padding: 13px 15px; border-radius: var(--r-sm);
    background: var(--mint); border: 1px solid var(--line-2);
    font-size: 12.5px; color: var(--mut); line-height: 1.6;
  }

  /* The redirect URI, given its own block because a byte-for-byte mismatch here
     is the single commonest reason a Connect button looks broken. */
  .redir {
    margin-bottom: 20px; padding: 14px 16px;
    border: 1px solid var(--teal); border-radius: var(--r-sm);
    background: var(--mint-2);
  }
  .redir-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
  .redir-uri {
    flex: 1; min-width: 220px;
    font-family: var(--mono); font-size: 12.5px; color: var(--teal-ink);
    background: #fff; border: 1px solid var(--line-2); border-radius: 10px;
    padding: 8px 12px; overflow-x: auto; white-space: nowrap;
  }

  .test-res { padding: 11px 14px; border-radius: var(--r-sm); font-size: 12.5px; }
  .test-res.ok { background: var(--green-soft); color: var(--green); }
  .test-res.bad { background: var(--red-soft); color: var(--red); }
  .test-head { font-weight: 700; line-height: 1.5; }
  .test-res .kv { margin-top: 8px; }
  .test-res .kv .r { padding: 6px 0; border-bottom-color: rgba(15, 28, 23, 0.08); font-size: 12px; }
  .test-res .kv .r span:first-child { color: inherit; opacity: 0.75; }
  .test-caveat { margin-top: 9px; font-size: 11.5px; opacity: 0.85; line-height: 1.5; font-weight: 500; }

  /* ================================================================
     Outreach
     ----------------------------------------------------------------
     Six tabs inside one view: Prospects, Templates, Sequences,
     Campaigns, Suppression, Deliverability. Everything here reuses the
     console's existing chrome — .card, .kv, .chip, .tbl-wrap,
     .warn-box, .fgrid — and adds only what has no equivalent yet: the
     pass/warn/fail finding rows, the rendered-message block, and the
     template picker.

     No rule here may be expressed as a style attribute. style-src
     'self' blocks an inline declaration wherever it is parsed from
     markup, and this file is where those live instead.
     ================================================================ */

  /* Several blocks below carry a display of their own, which would beat
     the user-agent rule for [hidden]. Toggling `hidden` has to win. */
  [hidden] { display: none !important; }

  .ot-tabs { margin-bottom: 20px; }
  .ot-pane { display: none; }
  .ot-pane.on { display: block; }

  .in-sm { padding: 6px 11px; font-size: 12.5px; border-radius: 10px; width: auto; }
  .card-b-tight { padding: 14px 20px; border-top: 1px solid var(--line); }
  .mt-20 { margin-top: 20px; }
  .mb-8 { margin-bottom: 8px; }

  /* The send gate, above every tab: "why did nothing go out" is the question
     this screen exists to answer, and the answer is never a tooltip. */
  .gate-state { margin-bottom: 20px; }
  .refusal {
    border: 1px solid rgba(179,55,46,0.32); border-left-width: 4px;
    border-radius: var(--r-sm); background: var(--red-soft);
    padding: 12px 15px; margin-top: 10px;
  }
  .refusal .rt { font-size: 13px; font-weight: 700; color: var(--red); }
  .refusal .rr { font-size: 12.5px; color: var(--ink); margin-top: 5px; line-height: 1.55; }
  .refusal .rf {
    margin-top: 9px; padding: 8px 12px; border-radius: 10px;
    background: #fff; border: 1px solid var(--line-2);
    font-size: 12px; color: var(--mut); line-height: 1.5;
  }
  .refusal .rf b { color: var(--ink); }
  .caution { border-color: rgba(185,119,8,0.3); background: var(--amber-soft); }
  .caution .rt { color: var(--amber); }

  /* One finding from server/deliverability.js. The remedy is always shown: a
     check that fails without naming the fix is a check that gets ignored. */
  .find {
    border: 1px solid var(--line-2); border-left-width: 4px;
    border-radius: var(--r-sm); padding: 11px 14px; margin-bottom: 9px;
  }
  .find-h { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
  .find-t { font-size: 13px; font-weight: 700; }
  .find-d { font-size: 12.5px; color: var(--mut); margin-top: 5px; line-height: 1.55; }
  .find-r { font-size: 12px; margin-top: 7px; line-height: 1.5; }
  .find-r b { font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--soft); }
  .find-e { font-family: var(--mono); font-size: 11.5px; color: var(--mut); margin-top: 6px; word-break: break-all; }
  .find.pass { border-left-color: var(--green); background: #fbfdfc; }
  .find.warn { border-left-color: var(--amber); background: var(--amber-soft); }
  .find.fail { border-left-color: var(--red); background: var(--red-soft); }
  .find.fail .find-r { color: var(--red); font-weight: 600; }

  /* The merged message, exactly as it would go on the wire. */
  .mailview { border: 1px solid var(--line-2); border-radius: var(--r-sm); overflow: hidden; margin-top: 14px; }
  .mailview .mh { background: var(--mint); padding: 11px 15px; border-bottom: 1px solid var(--line-2); }
  .mailview .mh .r { display: flex; gap: 10px; font-size: 12px; padding: 2px 0; }
  .mailview .mh .r span:first-child {
    font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--soft); width: 74px; flex-shrink: 0; padding-top: 2px;
  }
  .mailview .mh .r span:last-child { color: var(--ink); font-weight: 600; word-break: break-word; }
  .mailview .mb {
    padding: 15px; font-size: 13px; line-height: 1.62; color: var(--ink);
    white-space: pre-wrap; word-break: break-word; max-height: 420px; overflow-y: auto;
  }
  .mailview .mf {
    border-top: 1px solid var(--line); padding: 11px 15px;
    font-family: var(--mono); font-size: 11px; color: var(--mut); line-height: 1.6;
    word-break: break-all; background: #fbfdfc;
  }

  /* Template picker. */
  .tpl-group {
    font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
    color: var(--soft); padding: 12px 20px 5px;
  }
  .tpl-item {
    display: block; width: 100%; text-align: left;
    padding: 9px 20px; border: none; border-left: 3px solid transparent; background: transparent;
  }
  .tpl-item:hover { background: #fafdfc; }
  .tpl-item.on { background: var(--mint); border-left-color: var(--teal); }
  .tpl-item .n { font-size: 13px; font-weight: 600; color: var(--ink); }
  .tpl-item .wn { font-size: 11.5px; color: var(--mut); margin-top: 2px; }
  .merge { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 2px; }
  .merge code {
    font-family: var(--mono); font-size: 11px;
    background: var(--mint-2); color: var(--teal-ink);
    padding: 2px 8px; border-radius: 999px;
  }
  .field-help { display: grid; gap: 5px; margin-top: 8px; }
  .field-help div { font-size: 11.5px; color: var(--mut); }
  .field-help code { font-family: var(--mono); color: var(--teal-ink); }
  .subjects { display: grid; gap: 6px; margin-top: 4px; }
  .subjects label { display: flex; gap: 9px; align-items: flex-start; font-size: 12.5px; cursor: pointer; }
  .subjects input { margin-top: 3px; accent-color: var(--teal); }
  .body-raw {
    margin-top: 10px; padding: 12px 14px; border-radius: var(--r-sm);
    background: var(--mint); border: 1px solid var(--line-2);
    font-size: 12.5px; line-height: 1.6; white-space: pre-wrap; word-break: break-word;
    max-height: 260px; overflow-y: auto; color: var(--mut);
  }

  /* Sequence steps. */
  .step-row { display: grid; grid-template-columns: minmax(0, 1fr) 92px 34px; gap: 8px; margin-bottom: 8px; align-items: center; }
  .step-row .btn { padding: 6px 10px; }
  .seq-steps { display: grid; gap: 6px; padding: 4px 0 0; }
  .seq-step { display: flex; gap: 10px; align-items: baseline; font-size: 12.5px; }
  .seq-step .d {
    font-family: var(--mono); font-size: 11px; color: var(--teal-ink);
    background: var(--mint-2); border-radius: 999px; padding: 1px 9px; flex-shrink: 0;
  }

  /* Import preview. */
  .imp-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin: 14px 0; }
  .imp-tile { border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 10px 12px; background: #fff; }
  .imp-tile .l { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.09em; text-transform: uppercase; color: var(--mut); }
  .imp-tile .v { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; margin-top: 3px; }
  .imp-tile.bad { border-color: rgba(179,55,46,0.3); background: var(--red-soft); }
  .imp-tile.bad .v, .imp-tile.bad .l { color: var(--red); }
  .imp-tile.good { border-color: rgba(10,110,66,0.28); background: var(--green-soft); }
  .imp-tile.good .v, .imp-tile.good .l { color: var(--green); }
  .map-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }
  .map-grid label.f { font-size: 11.5px; }
  .hash { font-family: var(--mono); font-size: 11.5px; color: var(--mut); }
  .wrapcell { white-space: normal; max-width: 380px; line-height: 1.5; }
  .gate-no { color: var(--red); font-size: 11.5px; line-height: 1.45; margin-top: 3px; }

  @media (max-width: 820px) {
    .step-row { grid-template-columns: 1fr; }
    .card-h .end { margin-left: 0; flex-wrap: wrap; }
  }
