/* AI Humanizer — page styles (rebuilt 2026-09-25).
   Loaded after /css/nav-shared.css. Section 1 feeds the SITE nav/footer the index1.css variables and base .button
   rules they expect (tool pages do not load index1.css); everything else is scoped to .hz. */

/* ---- 1. Site chrome bridge (frozen copy of the site palette, same pattern as writing-assistant/site-chrome.css) ---- */
:root {
  --primary-color: #4F46E5; --secondary-color: #7C3AED; --primary-color-dark: #4A44C8;
  --bg-primary: #0D0C1D; --bg-secondary: #1A1A2E;
  --surface-glass: rgba(255, 255, 255, 0.05); --surface-glass-hover: rgba(255, 255, 255, 0.08);
  --glass-background: rgba(255, 255, 255, 0.05); --glass-background-hover: rgba(255, 255, 255, 0.08);
  --text-color: #FFFFFF; --text-primary: #FFFFFF; --text-secondary: #9CA3AF; --text-headings: #E5E7EB;
  --border-glass: rgba(255, 255, 255, 0.1); --border-glass-hover: rgba(255, 255, 255, 0.2);
  --dropdown-bg: #0D0C1D; --card-bg: rgba(255, 255, 255, 0.03);
  --transition-speed: 0.3s; --transition-ease: cubic-bezier(0.4, 0, 0.2, 1); --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --radius-sm: 0.375rem; --radius-md: 0.5rem; --radius-lg: 0.75rem;

  /* ---- humanizer tokens ---- */
  --hz-bg: #0D0C1D;
  --hz-surface: #15142A;
  --hz-surface-2: #1C1B36;
  --hz-line: rgba(255, 255, 255, 0.12);
  --hz-line-strong: rgba(255, 255, 255, 0.24);
  --hz-text: #F3F4F8;
  --hz-muted: #B4B8C7;          /* 9.0:1 on --hz-bg */
  --hz-faint: #9CA3AF;          /* 7.3:1 on --hz-bg, 6.6:1 on surface */
  --hz-accent: #8B7CFF;
  --hz-accent-strong: #6D5BFF;
  --hz-accent-text: #C4B5FD;
  --hz-focus: #FDE68A;
  --hz-ok: #34D399;
  --hz-warn: #FBBF24;
  --hz-bad: #F87171;
  --hz-ins-bg: rgba(52, 211, 153, 0.18);
  --hz-ins-line: #34D399;
  --hz-del-bg: rgba(248, 113, 113, 0.18);
  --hz-del-line: #F87171;
  --hz-radius: 14px;
  --hz-font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --hz-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: dark;
}

html, body.hz-body { background: var(--hz-bg); color: var(--hz-text); }
body.hz-body { margin: 0; font-family: var(--hz-font); line-height: 1.55; }
body.hz-body * { box-sizing: border-box; }
.hz-sitenav { position: relative; z-index: 50; }
.hz-sitenav a { color: inherit; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; padding: 0.6rem 1.2rem; border: none; border-radius: var(--radius-md); cursor: pointer; transition: all var(--transition-speed); font: 500 0.95rem/1.2 var(--hz-font); text-align: center; text-decoration: none; }
.button-primary { background: linear-gradient(135deg, var(--primary-color), #7C3AED); color: var(--text-color); border: 1px solid transparent; }
.button-outline { background: transparent; border: 1px solid var(--border-glass); color: var(--text-color); }
.button-outline:hover { background: var(--surface-glass-hover); border-color: var(--border-glass-hover); }
.nav-container :where(a, button, [tabindex]):focus-visible,
.mobile-menu :where(a, button, [tabindex]):focus-visible,
.banner-container a:focus-visible,
.footer-v2 :where(a, button):focus-visible { outline: 2px solid var(--hz-focus); outline-offset: 2px; }
/* Shared upgrade modal inside this page: font + CTA reflow (the modal's own CSS is shared chrome, not edited). */
#tpiUpgradeModal, #tpiUpgradeModal button { font-family: var(--hz-font); }
#tpiUpgradeModal .tpi-btn-primary { box-sizing: border-box; max-width: 100%; white-space: normal; }
#tpiUpgradeModal .tpi-resets-note, #tpiUpgradeModal .tpi-plan-price small { color: #555a67; }
#tpiUpgradeModal :where(a, button):focus-visible { outline: 3px solid #5b3df5; outline-offset: 2px; }
@media (prefers-color-scheme: dark) {
  #tpiUpgradeModal .tpi-resets-note, #tpiUpgradeModal .tpi-plan-price small { color: #aeb3c2; }
  #tpiUpgradeModal :where(a, button):focus-visible { outline-color: var(--hz-focus); }
}

/* ---- 2. Layout ---- */
/* `hidden` must win over every display rule below (a .hz-btn with hidden was still showing). */
.hz [hidden], .hz-dialog [hidden] { display: none !important; }
.hz { max-width: 1280px; margin: 0 auto; padding: 24px 24px 56px; }
.hz a { color: var(--hz-accent-text); text-underline-offset: 2px; }
.hz a:hover { color: #fff; }
/* Link-styled buttons keep their button colours (the .hz a colour made "Sign in again" 2.48:1). */
.hz a.hz-btn-primary, .hz a.hz-btn-primary:hover { color: #fff; text-decoration: none; }
.hz a.hz-btn-ghost, .hz a.hz-btn-ghost:hover { color: var(--hz-text); text-decoration: none; }
.hz-arrived { color: #A7F3D0; font-weight: 600; }
.hz-progress[data-hz-background="1"] .hz-spinner { border-top-color: var(--hz-ok); }
.hz :focus-visible { outline: 3px solid var(--hz-focus); outline-offset: 2px; border-radius: 6px; }
.hz code { font-family: var(--hz-mono); font-size: 0.9em; background: var(--hz-surface-2); padding: 0.05em 0.35em; border-radius: 4px; }
.hz-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.hz-hero { max-width: 880px; margin: 8px 0 18px; }
.hz-title { font-size: clamp(1.8rem, 3.2vw, 2.5rem); line-height: 1.15; margin: 0 0 10px; letter-spacing: -0.01em; color: #fff; }
.hz-lead { font-size: 1.08rem; color: var(--hz-muted); margin: 0 0 10px; }
.hz-honest-note { font-size: 0.92rem; color: var(--hz-muted); margin: 0; }
.hz-honest-note i { color: var(--hz-accent-text); margin-right: 4px; }

.hz-plan { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 10px 14px; margin: 0 0 16px;
  background: var(--hz-surface); border: 1px solid var(--hz-line); border-radius: 12px; font-size: 0.92rem; color: var(--hz-muted); }
.hz-plan strong { color: var(--hz-text); }
.hz-tier-chip { font-weight: 700; font-size: 0.78rem; letter-spacing: 0.04em; text-transform: uppercase; color: #111; background: var(--hz-accent-text); padding: 3px 9px; border-radius: 999px; }
.hz[data-hz-tier="pro"] .hz-tier-chip { background: #FCD34D; }
.hz-plan-sep { color: var(--hz-faint); }
.hz-plan-next { flex-basis: 100%; font-size: 0.86rem; }
@media (min-width: 1024px) { .hz-plan-next { flex-basis: auto; margin-left: auto; } }
.hz-usage.is-out strong[data-hz-usage-used] { color: var(--hz-bad); }
.hz-budget { flex-basis: 100%; font-size: 0.86rem; color: #FDE68A; }

.hz-tool { background: var(--hz-surface); border: 1px solid var(--hz-line); border-radius: var(--hz-radius); padding: 18px; }
.hz-controls { display: grid; grid-template-columns: minmax(200px, 1fr) minmax(0, 2fr) auto; gap: 14px 20px; align-items: start; margin-bottom: 16px; }
.hz-field { margin: 0; padding: 0; border: 0; min-width: 0; }
.hz-label { display: block; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--hz-faint); margin: 0 0 6px; padding: 0; }
.hz-select { width: 100%; font: inherit; color: var(--hz-text); background: var(--hz-surface-2); border: 1px solid var(--hz-line-strong); border-radius: 10px; padding: 9px 10px; min-height: 44px; }
.hz-help { font-size: 0.84rem; color: var(--hz-faint); margin: 6px 0 0; }
.hz-seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.hz-seg-opt { position: relative; display: block; cursor: pointer; }
.hz-seg-opt input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.hz-seg-opt span { display: flex; flex-direction: column; gap: 2px; height: 100%; min-height: 44px; padding: 8px 10px; border: 1px solid var(--hz-line-strong); border-radius: 10px; background: var(--hz-surface-2); }
.hz-seg-opt small { color: var(--hz-faint); font-size: 0.78rem; line-height: 1.3; }
.hz-seg-opt input:checked + span { border-color: var(--hz-accent); background: rgba(139, 124, 255, 0.16); box-shadow: inset 0 0 0 1px var(--hz-accent); }
.hz-seg-opt input:focus-visible + span { outline: 3px solid var(--hz-focus); outline-offset: 2px; }
.hz-field-check { align-self: center; padding-top: 18px; }
.hz-check { display: flex; gap: 8px; align-items: flex-start; cursor: pointer; font-size: 0.92rem; }
.hz-check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--hz-accent); flex: none; }
.hz-check small { color: var(--hz-faint); }
.hz-check-sm { font-size: 0.86rem; margin-top: 10px; }

.hz-panes { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.hz-pane { min-width: 0; display: flex; flex-direction: column; }
.hz-pane-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 36px; margin-bottom: 8px; }
.hz-pane-title { font-size: 1rem; font-weight: 700; margin: 0; color: #fff; }
.hz-input-wrap { position: relative; }
.hz-input { display: block; width: 100%; min-height: 340px; resize: vertical; font: 1rem/1.6 var(--hz-font); color: var(--hz-text);
  background: var(--hz-bg); border: 1px solid var(--hz-line-strong); border-radius: 12px; padding: 14px; unicode-bidi: plaintext; }
.hz-input::placeholder { color: var(--hz-faint); }
.hz-input:focus-visible { outline: 3px solid var(--hz-focus); outline-offset: 1px; }
.hz-input[aria-invalid="true"] { border-color: var(--hz-bad); }
.hz-count-row { display: flex; justify-content: flex-end; margin-top: 6px; }
.hz-count { font-size: 0.85rem; color: var(--hz-faint); font-variant-numeric: tabular-nums; }
.hz-count.is-over { color: var(--hz-bad); font-weight: 700; }
.hz-note { font-size: 0.86rem; color: var(--hz-muted); margin: 8px 0 0; }
.hz-note-warn { color: #FCA5A5; }
.hz-note-slow { color: #FDE68A; }

.hz-runbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 14px; }
.hz-disclosure { font-size: 0.82rem; color: var(--hz-faint); margin: 10px 0 0; }
.hz-disclosure i { margin-right: 3px; }
.hz-disclosure strong { color: var(--hz-muted); }

/* buttons */
.hz-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 16px; font: 600 0.95rem/1.2 var(--hz-font);
  border-radius: 10px; border: 1px solid transparent; cursor: pointer; text-decoration: none; transition: background-color 0.15s, border-color 0.15s, transform 0.1s; }
.hz-btn:disabled, .hz-btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }
.hz-btn-primary { background: var(--hz-accent-strong); color: #fff; }
.hz-btn-primary:hover:not(:disabled) { background: #5B48F0; }
.hz-btn-ghost { background: transparent; color: var(--hz-text); border-color: var(--hz-line-strong); }
.hz-btn-ghost:hover:not(:disabled) { background: var(--hz-surface-2); }
.hz-btn-danger { background: transparent; color: #FCA5A5; border-color: rgba(248, 113, 113, 0.55); }
.hz-btn-danger:hover:not(:disabled) { background: rgba(248, 113, 113, 0.12); }
.hz-btn-sm { min-height: 36px; padding: 6px 12px; font-size: 0.86rem; }
.hz-btn-run { min-width: 180px; font-size: 1.02rem; }
.hz-btn-run.is-busy { cursor: progress; }
/* confirmation must beat :hover (the pointer is still on the button right after the click) */
.hz-btn[data-hz-copy-state="copied"], .hz-btn[data-hz-copy-state="copied"]:hover:not(:disabled) { background: #047857; color: #fff; border-color: #34D399; }
.hz-btn[data-hz-copy-state="failed"], .hz-btn[data-hz-copy-state="failed"]:hover:not(:disabled) { background: transparent; color: #FCA5A5; border-color: var(--hz-bad); }

/* output pane */
.hz-pane-out { background: var(--hz-bg); border: 1px solid var(--hz-line); border-radius: 12px; padding: 12px 14px 14px; }
.hz-empty { color: var(--hz-muted); padding: 6px 2px; }
.hz-empty-title { font-weight: 700; color: var(--hz-text); margin: 0 0 8px; }
.hz-steps { margin: 0 0 12px; padding-left: 1.2rem; }
.hz-steps li { margin: 0 0 6px; }
.hz-empty-kept { font-size: 0.88rem; margin: 0; }
.hz-empty-kept i { color: var(--hz-ok); margin-right: 4px; }

.hz-progress { padding: 8px 2px; }
.hz-progress-row { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.hz-elapsed { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--hz-muted); font-weight: 500; }
.hz-spinner { width: 18px; height: 18px; border-radius: 50%; border: 3px solid var(--hz-line-strong); border-top-color: var(--hz-accent); animation: hz-spin 0.9s linear infinite; flex: none; }
@keyframes hz-spin { to { transform: rotate(360deg); } }
.hz-progress .hz-btn { margin-top: 12px; }

.hz-error { border: 1px solid rgba(248, 113, 113, 0.5); background: rgba(248, 113, 113, 0.08); border-radius: 10px; padding: 12px 14px; }
.hz-error[data-hz-error-kind="plan_limit"], .hz-error[data-hz-error-kind="plan_gate"], .hz-error[data-hz-error-kind="length_limit"], .hz-error[data-hz-error-kind="input"], .hz-error[data-hz-error-kind="daily_cap"], .hz-error[data-hz-error-kind="burst"] {
  border-color: rgba(251, 191, 36, 0.5); background: rgba(251, 191, 36, 0.07); }
.hz-error:focus { outline: none; }
.hz-error:focus-visible { outline: 3px solid var(--hz-focus); }
.hz-error-title { font-weight: 700; margin: 0 0 4px; color: #fff; }
.hz-error-msg { margin: 0; color: var(--hz-muted); }
.hz-error-charge { margin: 8px 0 0; font-size: 0.88rem; color: #A7F3D0; }
.hz-error-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.hz-error-actions:empty { display: none; }

.hz-result-text { white-space: pre-wrap; overflow-wrap: anywhere; word-break: normal; font-size: 1rem; line-height: 1.65; min-height: 200px; max-height: 560px; overflow: auto;
  padding: 4px 2px; unicode-bidi: plaintext; }
.hz-meta { font-size: 0.84rem; color: var(--hz-faint); margin: 10px 0 0; }
.hz-out-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

.hz-tabs { display: inline-flex; gap: 2px; background: var(--hz-surface-2); border-radius: 10px; padding: 3px; }
.hz-tabs [role="tab"] { font: 600 0.86rem var(--hz-font); color: var(--hz-muted); background: transparent; border: 0; border-radius: 8px; padding: 6px 12px; min-height: 34px; cursor: pointer; }
.hz-tabs [role="tab"][aria-selected="true"] { background: var(--hz-accent-strong); color: #fff; }

.hz-compare-legend { font-size: 0.8rem; color: var(--hz-faint); margin: 6px 0; display: flex; gap: 10px; }
.hz-compare-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.hz-compare-h { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--hz-faint); margin: 0 0 4px; }
.hz-compare-col { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.94rem; line-height: 1.6; max-height: 520px; overflow: auto; padding: 8px; border: 1px solid var(--hz-line); border-radius: 8px; unicode-bidi: plaintext; }
.hz-ins, .hz-del { border-radius: 3px; padding: 0 1px; }
.hz-ins { background: var(--hz-ins-bg); box-shadow: inset 0 -2px 0 var(--hz-ins-line); color: #ECFDF5; }
.hz-del { background: var(--hz-del-bg); text-decoration: line-through; text-decoration-color: var(--hz-del-line); color: #FEE2E2; }

.hz-detector { margin-top: 12px; border-top: 1px solid var(--hz-line); padding-top: 12px; }
.hz-detector-status { margin: 0 0 8px; font-size: 0.9rem; color: var(--hz-muted); }
.hz-detector-scores { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 8px; }
.hz-score { background: var(--hz-surface); border: 1px solid var(--hz-line); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; }
.hz-score-k { font-size: 0.8rem; color: var(--hz-faint); }
.hz-score-v { font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.hz-detector-method { font-size: 0.82rem; color: var(--hz-faint); margin: 0; }

/* pending markers — deliberately loud; the ship check fails while any exists */
.hz-pending { display: inline-block; margin-top: 6px; font-weight: 800; color: #111; background: repeating-linear-gradient(45deg, #FDE047, #FDE047 10px, #FACC15 10px, #FACC15 20px); padding: 4px 8px; border-radius: 6px; }
.hz-pending-block { display: block; padding: 14px; font-weight: 500; }
.hz-info .hz-pending-block p, .hz-pending-block strong, .hz-pending-block caption { color: #111; }
.hz-pending-block .hz-table { background: rgba(255, 255, 255, 0.6); color: #111; }
.hz-pending-block .hz-table th, .hz-pending-block .hz-table td { border-color: rgba(0, 0, 0, 0.2); color: #111; }
.hz-pending-block code { background: rgba(0, 0, 0, 0.1); color: #111; }

/* dialogs */
.hz-dialog { width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow: auto; background: var(--hz-surface); color: var(--hz-text); border: 1px solid var(--hz-line-strong); border-radius: 14px; padding: 18px; }
.hz-dialog::backdrop { background: rgba(5, 5, 15, 0.7); }
.hz-dialog h2 { margin: 0; font-size: 1.2rem; }
.hz-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.hz-dialog-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.hz-consent p { color: var(--hz-muted); }
.hz-history-tools { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.hz-history-list { list-style: none; margin: 8px 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.hz-history-item { border: 1px solid var(--hz-line); border-radius: 10px; padding: 10px 12px; background: var(--hz-bg); }
.hz-history-item-meta { font-size: 0.8rem; color: var(--hz-faint); margin: 0 0 4px; }
.hz-history-item-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; unicode-bidi: plaintext; }
.hz-history-item-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

/* info sections */
.hz-info { max-width: 900px; margin: 44px 0 0; }
.hz-info h2 { font-size: 1.45rem; margin: 0 0 12px; color: #fff; }
.hz-info p, .hz-info li, .hz-info dd { color: var(--hz-muted); }
.hz-howlist { padding-left: 1.2rem; }
.hz-howlist li { margin-bottom: 8px; }
.hz-howlist strong, .hz-info dt { color: var(--hz-text); }
.hz-table-wrap { max-width: 100%; overflow-x: auto; }
.hz-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; margin: 12px 0; }
.hz-table caption { text-align: left; font-weight: 700; padding: 6px 0; color: inherit; }
.hz-table th, .hz-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--hz-line); vertical-align: top; color: var(--hz-muted); }
.hz-table thead th { color: var(--hz-text); font-size: 0.82rem; }
.hz-table tbody th { color: var(--hz-text); }
.hz-table tr[aria-current="true"] { background: rgba(139, 124, 255, 0.12); }
.hz-table small { color: var(--hz-faint); font-weight: 400; }
.hz-modes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 24px; margin: 0; }
.hz-modes dt { font-weight: 700; }
.hz-modes dt small { font-weight: 600; font-size: 0.75rem; color: var(--hz-accent-text); margin-left: 6px; }
.hz-modes dd { margin: 2px 0 0; font-size: 0.92rem; }
.hz-faq { border-bottom: 1px solid var(--hz-line); padding: 10px 0; }
.hz-faq summary { cursor: pointer; font-weight: 600; color: var(--hz-text); min-height: 32px; display: flex; align-items: center; }
.hz-faq p { margin: 6px 0 4px; }
.hz-related-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.hz-related-list span { color: var(--hz-faint); font-size: 0.9rem; margin-left: 6px; }

/* ---- 3. Responsive ---- */
@media (max-width: 1023px) {
  .hz-controls { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .hz-field-check { grid-column: 1 / -1; padding-top: 0; }
}
@media (max-width: 859px) {
  .hz { padding: 16px 16px 48px; }
  .hz-panes { grid-template-columns: minmax(0, 1fr); }
  .hz-controls { grid-template-columns: minmax(0, 1fr); }
  .hz-input { min-height: 220px; }
  .hz-result-text { min-height: 120px; }
}
@media (max-width: 599px) {
  .hz-tool { padding: 12px; border-radius: 12px; }
  .hz-seg small { display: none; }
  .hz-compare-grid { grid-template-columns: minmax(0, 1fr); }
  .hz-modes { grid-template-columns: minmax(0, 1fr); }
  .hz-btn-run { width: 100%; }
  .hz-runbar .hz-btn { flex: 1 1 auto; }
  .hz-out-actions .hz-btn { flex: 1 1 100%; }
  .hz-detector-scores { grid-template-columns: minmax(0, 1fr); }
  .hz-plan-sep { display: none; }
  .hz-plan > span { flex-basis: 100%; }
  .hz-plan > .hz-tier-chip { flex-basis: auto; }
  .hz-table { font-size: 0.84rem; }
}
@media (prefers-reduced-motion: reduce) {
  .hz *, .hz *::before, .hz *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
  .hz-spinner { animation: none; border-top-color: var(--hz-line-strong); border-right-color: var(--hz-accent); }
}
@media (forced-colors: active) {
  .hz-ins { text-decoration: underline; }
  .hz-btn { border: 1px solid ButtonText; }
}

/* Tables as stacked cards on phones: every cell carries its column name (data-label), so nothing needs a
   sideways scroll at 390 (frontend critic r2 M2). */
@media (max-width: 599px) {
  .hz-table, .hz-table tbody, .hz-table tr, .hz-table th, .hz-table td { display: block; width: 100%; }
  .hz-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .hz-table tr { border: 1px solid var(--hz-line); border-radius: 10px; margin: 0 0 10px; padding: 6px 4px; }
  .hz-table th, .hz-table td { border: 0; padding: 4px 8px; }
  .hz-table td[data-label]::before { content: attr(data-label) ": "; font-weight: 600; color: var(--hz-text); }
  .hz-table caption { display: block; }
}

/* Signed-out banner: sits above the panes, never replaces a result (frontend critic r2 N1). */
.hz-signedout { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin: 0 0 12px; padding: 10px 14px; border-radius: 10px; border: 1px solid rgba(251, 191, 36, 0.55); background: rgba(251, 191, 36, 0.08); }
.hz-signedout p { margin: 0; flex: 1 1 260px; color: var(--hz-text); }
.hz-caveat { margin-top: 10px; color: var(--hz-muted); }
.hz-logs { display: inline; }
.hz-logs summary { display: inline; cursor: pointer; color: var(--hz-accent-text); text-decoration: underline; }
.hz-logs[open] { display: block; margin: 4px 0; }
/* Shared modal, dark scheme: its plan name stays #5b3df5 on #23263a (2.43:1). Override inside the modal only. */
/* Shared modal's close "×" (2.62:1) and "Maybe later" (4.0:1) on its light card. */
#tpiUpgradeModal .tpi-modal-close { color: #5f6472; }
#tpiUpgradeModal .tpi-btn-secondary { color: #4a4f5e; }
@media (prefers-color-scheme: dark) {
  #tpiUpgradeModal .tpi-modal-close, #tpiUpgradeModal .tpi-btn-secondary { color: #c5c9d6; }
  #tpiUpgradeModal .tpi-plan-name { color: #B9A8FF; }
  #tpiUpgradeModal .tpi-benefits li i { color: #B9A8FF; }
}
/* Shared modal promo ribbon: white on a gradient ending in #ff6ec7 is 2.53:1. Same hues, darker stops (>= 5:1). */
#tpiUpgradeModal .tpi-free-ribbon { background: linear-gradient(135deg, #5b3df5, #7a3fd6 45%, #b0287a); }

/* Restored-after-sign-in notice (critic r3 R3-1). */
.hz-restored { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin: 0 0 12px; padding: 10px 14px; border-radius: 10px; border: 1px solid rgba(52, 211, 153, 0.5); background: rgba(52, 211, 153, 0.08); }
.hz-restored p { margin: 0; flex: 1 1 260px; color: var(--hz-text); }

/* r6: history outcome on its own line; a NOT-saved outcome is a visible warning (E2E r4 L4-d) */
.hz-history-notice { font-size: 0.9rem; margin: 8px 0 0; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--hz-line); overflow-wrap: anywhere; }
.hz-history-notice.is-warn { border-color: var(--hz-warn); border-left-width: 4px; color: var(--hz-text); font-weight: 600; }
.hz-save-hint { margin: 4px 0 0; }

/* r6 (FE r4 R4-4, measured on the rig): the site's Keeper launcher (shared chrome, fixed bottom-right) sits over the
   mode select at 390 and the text box's corner at 768 on the first screen. Scoped mitigation on this page only: while
   you are using one of the tool's controls, the CLOSED launcher fades out and stops catching clicks; it returns on blur.
   The static first-screen overlap is a shared-chrome decision, reported to the orchestrator. */
body:has(.hz :is(textarea, select, input, button, summary):focus) .pk-root:not(.pk-is-open),
body:has(.hz-fp-info[open]) .pk-root:not(.pk-is-open) { opacity: 0; pointer-events: none; transition: opacity .15s ease; }

/* r6b (closing-bar rule 3, coordinator): a SAFE ZONE for the site's Keeper launcher on this page only, so no humanizer
   control is ever under it, at any width and any scroll position (horizontal disjointness, not a scroll snapshot).
   - The CLOSED launcher is shown as its round icon, 40 x 40 (32px avatar + 4px padding), 4px from the right edge.
     The widget's own stable hooks: .pk-root (fixed root) / .pk-launcher / .pk-launcher-label / .pk-is-open (open state).
     The open panel is untouched.
   - The tool reserves a right gutter of --hz-keeper-zone (4 + 40 + 8 = 52px) beyond the viewport's right edge; when the
     centred 1280px column already leaves that much margin, the normal padding applies. */
body.hz-body { --hz-keeper-zone: 52px; }
body.hz-body .pk-root:not(.pk-is-open) { right: 4px; bottom: 12px; }
body.hz-body .pk-root:not(.pk-is-open) .pk-launcher { padding: 4px; }
body.hz-body .pk-root:not(.pk-is-open) .pk-launcher-label { display: none; }
body.hz-body .hz { padding-right: max(24px, calc(var(--hz-keeper-zone) - max(0px, (100vw - 1280px) / 2) + 16px)); }
@media (max-width: 859px) {
  body.hz-body .hz { padding-right: var(--hz-keeper-zone); }
}
/* The shared upgrade modal is not in the top layer, and the launcher's z-index is above it: hide the closed launcher while it
   is open, so it can't sit on the modal's buttons (our own <dialog>s use showModal and are already above it). */
body.hz-body:has(#tpiUpgradeModal.is-open, #tpiUpgradeModal.show) .pk-root:not(.pk-is-open) { visibility: hidden; }

/* AI fingerprints (docs/60): toggle + info, input chip, read-only preview, output line, clean-only result label */
.hz-fp { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-top: 8px; }
.hz-fp-info summary { cursor: pointer; color: var(--hz-accent-text); font-size: 0.88rem; min-height: 24px; display: inline-flex; align-items: center; }
.hz-fp { position: relative; }   /* the popover is anchored to the whole toggle row, so it can never start mid-row */
/* An overlay popover (owner bug 2026-09-26): opening it must never reflow the options grid or push the page down. */
.hz-fp-pop { position: absolute; top: calc(100% + 6px); right: 0; z-index: 40; box-sizing: border-box;
  width: min(440px, calc(100vw - 32px)); max-height: 60vh; overflow: auto; padding: 12px 14px;
  background: var(--hz-surface-2); color: var(--hz-text); border: 1px solid var(--hz-line-strong); border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45); }
.hz-fp-info:not([open]) .hz-fp-pop { display: none; }   /* Chrome lays out closed <details> content (content-visibility): no box at all when closed */
.hz-fp-pop p { font-size: 0.88rem; color: var(--hz-muted); margin: 0 0 8px; }
.hz-fp-pop p:last-child { margin-bottom: 0; }
@media (max-width: 1023px) { .hz-fp-pop { right: auto; left: 0; } }   /* single-column widths: from the row's left edge */
.hz-fp-chip { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.hz-fp-preview { margin: 6px 0 0; padding: 10px 12px; max-height: 240px; overflow-y: auto; overflow-wrap: anywhere; white-space: pre-wrap;
  border: 1px dashed var(--hz-line-strong); border-radius: 8px; background: var(--hz-surface); color: var(--hz-text); font-size: 0.9rem; line-height: 1.6; }
.hz-fp-mark { background: var(--hz-ins-bg); color: var(--hz-text); border-bottom: 2px solid var(--hz-warn); border-radius: 2px; padding: 0 1px; }
.hz-fp-token { font: 600 0.72em var(--hz-mono); letter-spacing: 0.02em; padding: 0 3px; }
.hz-result-kind { display: inline-block; margin: 0 0 8px; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--hz-line-strong); font-size: 0.84rem; font-weight: 600; color: var(--hz-text); }
.hz-result-kind[hidden] { display: none; }
.hz-fp-out { margin: 6px 0 0; }
