/* countersign.css: the trust panel inside the runtime's consent card, the blocked
   notice, and the "always allow" re-check line. Theme it by overriding the --cs-*
   variables on :root or on any ancestor. No external fonts or images. */

:root {
  --cs-font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --cs-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --cs-radius: 10px;
  --cs-bg: #ffffff;
  --cs-fg: #1c2230;
  --cs-muted: #5b6475;
  --cs-border: #d9dee7;
  --cs-ok: #11703e;
  --cs-ok-bg: #e7f6ed;
  --cs-warn: #8a5300;
  --cs-warn-bg: #fff3dc;
  --cs-bad: #b42318;
  --cs-bad-bg: #fdecea;
  --cs-pending: #3d5a99;
  --cs-pending-bg: #eaf0fb;
  --cs-code-bg: #f4f6f9;
}

/* Dark palette. Light is the default because the runtime's consent card is light.
   Opt in on any ancestor: data-theme="dark" or data-cs-theme="dark" forces dark, and
   data-cs-theme="auto" follows the visitor's system setting. */
[data-theme="dark"], [data-cs-theme="dark"] {
  --cs-bg: #171b24;
  --cs-fg: #e7eaf0;
  --cs-muted: #a3acbd;
  --cs-border: #333b4b;
  --cs-ok: #6fd69b;
  --cs-ok-bg: #12301f;
  --cs-warn: #f3c06b;
  --cs-warn-bg: #352812;
  --cs-bad: #ff8f84;
  --cs-bad-bg: #3a1714;
  --cs-pending: #9db7ef;
  --cs-pending-bg: #1b2540;
  --cs-code-bg: #10131a;
}
@media (prefers-color-scheme: dark) {
  [data-cs-theme="auto"]:not([data-theme="light"]) {
    --cs-bg: #171b24;
    --cs-fg: #e7eaf0;
    --cs-muted: #a3acbd;
    --cs-border: #333b4b;
    --cs-ok: #6fd69b;
    --cs-ok-bg: #12301f;
    --cs-warn: #f3c06b;
    --cs-warn-bg: #352812;
    --cs-bad: #ff8f84;
    --cs-bad-bg: #3a1714;
    --cs-pending: #9db7ef;
    --cs-pending-bg: #1b2540;
    --cs-code-bg: #10131a;
  }
}

/* ---- panel inside the consent card ---- */
.cs-panel {
  font-family: var(--cs-font);
  color: var(--cs-fg);
  background: var(--cs-bg);
  border: 1px solid var(--cs-border);
  border-left: 4px solid var(--cs-tone, var(--cs-pending));
  border-radius: var(--cs-radius);
  padding: 10px 12px;
  margin: 8px 0 10px;
  font-size: 13px;
  line-height: 1.45;
  font-style: normal;
  text-align: left;
}
.cs-tone-ok { --cs-tone: var(--cs-ok); --cs-tone-bg: var(--cs-ok-bg); }
.cs-tone-warn { --cs-tone: var(--cs-warn); --cs-tone-bg: var(--cs-warn-bg); }
.cs-tone-bad { --cs-tone: var(--cs-bad); --cs-tone-bg: var(--cs-bad-bg); }
.cs-tone-pending { --cs-tone: var(--cs-pending); --cs-tone-bg: var(--cs-pending-bg); }

.cs-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.cs-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 10px 2px 3px;
  border-radius: 999px;
  background: var(--cs-tone-bg);
  color: var(--cs-tone);
  font-weight: 650;
  font-size: 12.5px;
}
.cs-chip-icon {
  display: inline-grid; place-items: center;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--cs-tone);
  color: var(--cs-bg);
  font-size: 11px;
  font-weight: 800;
}
.cs-tone-pending .cs-chip-icon { animation: cs-pulse 1.2s ease-in-out infinite; }
@keyframes cs-pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .cs-tone-pending .cs-chip-icon { animation: none; } }

.cs-brand {
  font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--cs-muted); font-weight: 600;
}
.cs-summary { margin: 4px 0 6px; }
.cs-advice { margin: 4px 0; color: var(--cs-warn); font-weight: 550; }
.cs-local {
  display: inline-block; margin: 2px 0 6px; padding: 1px 8px;
  border: 1px dashed var(--cs-warn); border-radius: 6px;
  color: var(--cs-warn); font-size: 12px;
}

.cs-facts { display: grid; grid-template-columns: max-content 1fr; gap: 2px 10px; margin: 4px 0 6px; font-size: 12.5px; }
.cs-facts dt { color: var(--cs-muted); }
.cs-facts dd { margin: 0; }

/* ---- details: trace and decoded tokens ---- */
.cs-details { margin-top: 4px; font-size: 12.5px; }
.cs-details > summary {
  cursor: pointer; color: var(--cs-muted); font-weight: 600; width: fit-content;
  border-radius: 4px;
}
.cs-details > summary:focus-visible { outline: 2px solid var(--cs-pending); outline-offset: 2px; }
.cs-trace { list-style: none; margin: 8px 0 4px; padding: 0 0 0 4px; border-left: 2px solid var(--cs-border); }
.cs-step { position: relative; display: grid; grid-template-columns: 18px 1fr; column-gap: 6px; padding: 3px 0 3px 6px; }
.cs-step-mark { grid-row: span 2; font-weight: 800; text-align: center; }
.cs-step-ok .cs-step-mark { color: var(--cs-ok); }
.cs-step-fail .cs-step-mark { color: var(--cs-bad); }
.cs-step-info .cs-step-mark { color: var(--cs-muted); }
.cs-step-name { font-weight: 650; }
.cs-step-detail { color: var(--cs-fg); overflow-wrap: anywhere; }
.cs-tokens-title { margin: 8px 0 4px; font-weight: 650; color: var(--cs-muted); }
.cs-token {
  margin: 0 0 6px; padding: 8px; max-height: 220px; overflow: auto;
  background: var(--cs-code-bg); border: 1px solid var(--cs-border); border-radius: 6px;
  font-family: var(--cs-mono); font-size: 11.5px; white-space: pre-wrap; overflow-wrap: anywhere;
  color: var(--cs-fg);
}
.cs-checked { margin-top: 4px; color: var(--cs-muted); font-size: 11.5px; }

/* ---- blocked notice in the chat ---- */
.cs-blocked {
  font-family: var(--cs-font);
  color: var(--cs-fg);
  background: var(--cs-bad-bg);
  border: 1px solid var(--cs-bad);
  border-left-width: 4px;
  border-radius: var(--cs-radius);
  padding: 10px 12px;
  max-width: 95%;
  font-size: 13px;
  line-height: 1.45;
}
.cs-blocked-title { display: flex; align-items: center; gap: 8px; color: var(--cs-bad); font-weight: 750; font-size: 14px; }
.cs-blocked-icon {
  display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%;
  background: var(--cs-bad); color: var(--cs-bad-bg); font-size: 12px; font-weight: 800;
}
.cs-blocked-sub { margin: 2px 0 4px; color: var(--cs-muted); font-size: 12px; }
.cs-blocked .cs-details { background: var(--cs-bg); border-radius: 8px; padding: 6px 8px; }
.cs-blocked-done { color: var(--cs-bad) !important; }

/* ---- "always allow" re-check line ---- */
.cs-remembered {
  font-family: var(--cs-font);
  font-size: 12.5px;
  color: var(--cs-fg);
  background: var(--cs-tone-bg, var(--cs-pending-bg));
  border-left: 3px solid var(--cs-tone, var(--cs-pending));
  border-radius: 8px;
  padding: 6px 10px;
  max-width: 95%;
}
