/* AssureLoop static demo. Plain CSS, no build step, no web fonts. */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --ink: #17212b;
  --ink-soft: #4a5764;
  --ink-faint: #6b7885;
  --line: #dfe3e8;
  --line-soft: #eceff3;
  --brand: #1d4ed8;
  --brand-soft: #e8edfd;
  --ok: #1f7a44;
  --ok-soft: #e6f4ec;
  --warn: #8a5a00;
  --warn-soft: #fdf1da;
  --bad: #a12121;
  --bad-soft: #fbe9e9;
  --blind: #4a3f8f;
  --blind-soft: #eeebfa;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(23, 33, 43, 0.06), 0 8px 24px rgba(23, 33, 43, 0.05);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  overflow-x: hidden;
}

h1, h2, h3 { line-height: 1.25; margin: 0 0 0.4em; }
h1 { font-size: 1.35rem; }
h2 { font-size: 1.02rem; letter-spacing: 0.01em; text-transform: uppercase; color: var(--ink-soft); }
h3 { font-size: 0.95rem; }

p { margin: 0 0 0.8em; }
p:last-child { margin-bottom: 0; }

a { color: var(--brand); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

code, .mono { font-family: var(--mono); font-size: 0.86em; }

.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 28px; }

.skip-link {
  position: absolute; left: -9999px; top: 0; background: var(--ink); color: #fff;
  padding: 10px 16px; z-index: 20; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

/* header */
.site-header { background: #0d1a2b; color: #f2f6fa; }
.header-inner { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding-top: 18px; padding-bottom: 18px; flex-wrap: wrap; }
.brand { margin: 0; display: flex; align-items: baseline; gap: 8px; font-size: 1.18rem; }
.brand-mark { width: 14px; height: 14px; border-radius: 4px; background: #4ade80; display: inline-block; transform: translateY(2px); }
.brand-name { font-weight: 700; letter-spacing: -0.01em; }
.brand-for { color: #9fb3c8; font-weight: 400; font-size: 0.95rem; }
.brand-tag { margin: 0; color: #9fb3c8; font-size: 0.9rem; }

.notice { background: #eef2f8; border-bottom: 1px solid var(--line); }
.notice p { padding: 12px 0; margin: 0; font-size: 0.9rem; color: #2b3a49; }
.notice em { font-style: normal; font-weight: 600; }

/* boundary */
.boundary { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; margin: 22px 0; box-shadow: var(--shadow); }
.boundary-foot { margin: 34px 0 0; border-radius: 0; border-left: 0; border-right: 0; border-bottom: 0; box-shadow: none; }
.boundary-line { margin: 0; font-size: 0.92rem; color: var(--ink-soft); }
.boundary-label { font-weight: 600; color: var(--ink); }
.boundary-full { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 28px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.boundary-col h3 { color: var(--ink); text-transform: none; font-size: 0.92rem; }
.boundary-col ul { margin: 0; padding-left: 18px; color: var(--ink-soft); font-size: 0.9rem; }
.boundary-col li { margin-bottom: 6px; }

/* tabs */
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 22px; flex-wrap: wrap; }
.tab {
  appearance: none; border: 0; background: none; font: inherit; font-size: 0.94rem;
  color: var(--ink-faint); padding: 10px 14px; border-bottom: 2px solid transparent;
  cursor: pointer; border-radius: 6px 6px 0 0;
}
.tab:hover { color: var(--ink); background: #eef1f5; }
.tab.is-active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }
.tab:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.panel { animation: fade 120ms ease-out; }
@keyframes fade { from { opacity: 0.4; } to { opacity: 1; } }

.panel-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.panel-head h1 { margin-bottom: 4px; }
.muted { color: var(--ink-faint); }
.small { font-size: 0.85rem; }
.scan-meta { margin: 0; font-family: var(--mono); font-size: 0.78rem; color: var(--ink-faint); text-align: right; }

/* counters */
.counters { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-bottom: 20px; }
.counter { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.counter-value { display: block; font-size: 1.7rem; font-weight: 700; line-height: 1.1; }
.counter-label { display: block; margin-top: 4px; font-size: 0.7rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-faint); }
.counter[data-state="VERIFIED"] .counter-value { color: var(--ok); }
.counter[data-state="STALE"] .counter-value { color: var(--warn); }
.counter[data-state="MISSING"] .counter-value { color: var(--bad); }
.counter[data-state="NOT_VISIBLE"] .counter-value { color: var(--blind); }
.counter[data-state="INCOMPLETE"] .counter-value { color: var(--ink-soft); }

/* cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 18px; box-shadow: var(--shadow); }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.card-head h2 { margin: 0; }

.kv { margin: 0 0 10px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 22px; }
.kv div { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px dotted var(--line); padding-bottom: 5px; }
.kv dt { color: var(--ink-faint); font-size: 0.85rem; }
.kv dd { margin: 0; font-weight: 600; font-size: 0.9rem; text-align: right; }

/* table */
.table { width: 100%; }
.tr {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr) 104px minmax(0, 0.8fr) 116px 74px 62px;
  gap: 10px 12px;
  align-items: start;
  padding: 11px 0;
  border-top: 1px solid var(--line-soft);
  font-size: 0.88rem;
}
.tr:first-child { border-top: 0; }
.tr.head { font-size: 0.68rem; letter-spacing: 0.07em; text-transform: uppercase; color: var(--ink-faint); padding-bottom: 8px; }
.tr .control { font-family: var(--mono); font-weight: 600; font-size: 0.82rem; }
.tr .claim-text { color: var(--ink); }
.tr .claim-key { display: block; font-family: var(--mono); font-size: 0.72rem; color: var(--ink-faint); margin-top: 3px; }
.tr .evidence { min-width: 0; }
.tr .evidence a { display: inline-block; max-width: 100%; overflow-wrap: anywhere; }
.tr .time { font-family: var(--mono); font-size: 0.76rem; color: var(--ink-soft); }
.tr .window { font-family: var(--mono); font-size: 0.76rem; color: var(--ink-soft); }
.tr .why-cell { text-align: right; }

.state { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap; }
.state[data-state="VERIFIED"] { background: var(--ok-soft); color: var(--ok); }
.state[data-state="STALE"] { background: var(--warn-soft); color: var(--warn); }
.state[data-state="MISSING"] { background: var(--bad-soft); color: var(--bad); }
.state[data-state="NOT_VISIBLE"] { background: var(--blind-soft); color: var(--blind); }
.state[data-state="INCOMPLETE"] { background: var(--line-soft); color: var(--ink-soft); }

.reason { grid-column: 1 / -1; color: var(--ink-soft); font-size: 0.85rem; margin: 2px 0 0; }
.reason strong { color: var(--ink); font-weight: 600; }

/* why / trace */
.trace { grid-column: 1 / -1; background: #f8fafc; border: 1px solid var(--line); border-left: 3px solid var(--brand); border-radius: 8px; padding: 12px 14px; margin-top: 6px; }
.trace h3 { margin: 0 0 8px; font-size: 0.78rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-faint); }
.hop { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); gap: 4px 14px; padding: 7px 0; border-top: 1px dashed var(--line); font-size: 0.82rem; }
.hop:first-of-type { border-top: 0; }
.hop-from { font-weight: 600; }
.hop-from span { display: block; font-weight: 400; color: var(--ink-faint); font-size: 0.76rem; }
.hop-ari { font-family: var(--mono); font-size: 0.72rem; color: var(--ink-soft); overflow-wrap: anywhere; }
.hop-meta { grid-column: 1 / -1; display: flex; gap: 14px; flex-wrap: wrap; font-family: var(--mono); font-size: 0.72rem; color: var(--ink-faint); }
.trace-foot { margin: 10px 0 0; padding-top: 8px; border-top: 1px dashed var(--line); font-family: var(--mono); font-size: 0.72rem; color: var(--ink-faint); }

/* buttons */
.button {
  appearance: none; font: inherit; font-size: 0.85rem; font-weight: 600;
  background: var(--brand); color: #fff; border: 1px solid var(--brand);
  padding: 8px 14px; border-radius: 7px; cursor: pointer;
}
.button:hover { background: #1740b4; }
.button.ghost { background: var(--surface); color: var(--brand); }
.button.ghost:hover { background: var(--brand-soft); }
.button:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.link-button {
  appearance: none; background: none; border: 0; padding: 0 2px; font: inherit;
  font-size: 0.88rem; font-weight: 600; color: var(--brand); cursor: pointer;
  text-decoration: underline; text-underline-offset: 2px;
}
.link-button:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 3px; }
.why { text-align: right; }

/* evidence panel */
.evidence-list { display: grid; gap: 12px; margin-bottom: 18px; }
.claim-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.claim-card header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 8px; flex-wrap: wrap; }
.claim-card h2 { text-transform: none; font-size: 0.95rem; letter-spacing: 0; color: var(--ink); margin: 0; }
.claim-card .claim-line { margin: 0 0 8px; color: var(--ink-soft); }
.claim-card .meta { display: flex; gap: 16px; flex-wrap: wrap; font-size: 0.78rem; color: var(--ink-faint); font-family: var(--mono); }
.claim-card .meta a { font-family: var(--sans); }
.claim-card .trace { margin-top: 12px; }

/* pack */
.pack-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 8px; }
.fingerprint { margin: 0; font-family: var(--mono); font-size: 0.8rem; color: var(--ink-soft); overflow-wrap: anywhere; }
.pack-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.pack-result { min-height: 1.4em; margin: 6px 0 12px; font-size: 0.85rem; font-weight: 600; }
.pack-result[data-tone="ok"] { color: var(--ok); }
.pack-result[data-tone="bad"] { color: var(--bad); }
.pack-table .tr { grid-template-columns: 74px minmax(0, 1fr) 92px minmax(0, 0.9fr) 110px 66px 92px; }

/* footer */
.site-footer { color: var(--ink-faint); font-size: 0.82rem; padding: 20px 0 34px; }
.site-footer code { color: var(--ink-soft); }

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .wrap { padding: 0 18px; }
  .counters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tr { grid-template-columns: 78px minmax(0, 1fr) 92px; }
  .tr.head { display: none; }
  .tr .evidence, .tr .time, .tr .window { grid-column: 2 / -1; }
  .tr .why-cell { grid-column: 3; grid-row: 1; }
  .tr .evidence::before { content: "Evidence: "; color: var(--ink-faint); }
  .tr .time::before { content: "Observed: "; color: var(--ink-faint); }
  .tr .window::before { content: "Window: "; color: var(--ink-faint); }
  .pack-table .tr { grid-template-columns: 70px minmax(0, 1fr) 86px; }
  .kv { grid-template-columns: 1fr; }
  .boundary-full { grid-template-columns: 1fr; }
  .scan-meta { text-align: left; }
}

@media (max-width: 620px) {
  body { font-size: 15px; }
  .wrap { padding: 0 14px; }
  .counters { grid-template-columns: 1fr; }
  .counter { display: flex; align-items: baseline; justify-content: space-between; padding: 10px 14px; }
  .counter-value { font-size: 1.35rem; }
  .counter-label { margin-top: 0; }
  .tr { grid-template-columns: 1fr; gap: 4px 0; }
  .tr .control, .tr .claim-text, .tr .evidence, .tr .time, .tr .window, .tr .reason, .tr .why-cell { grid-column: 1; grid-row: auto; }
  .tr .why-cell { text-align: left; }
  .tr .state { justify-self: start; }
  .panel-head { flex-direction: column; align-items: flex-start; }
  .pack-head, .pack-actions { flex-direction: column; align-items: stretch; }
  .pack-actions .button { width: 100%; }
  .hop { grid-template-columns: 1fr; }
  .claim-card header { flex-direction: column; }
  .boundary { padding: 12px 14px; }
}

/* --- Custom controls: a small form and a JSON paste ------------------------- */
.custom-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px 14px;
  align-items: end;
  margin: 12px 0 6px;
}
.custom-form .field { display: grid; gap: 4px; min-width: 0; }
.custom-form .field > span { font-size: 0.78rem; color: var(--ink-faint); }
.custom-form .field.check { display: flex; align-items: center; gap: 8px; grid-column: 1 / -1; }
.custom-form input[type="text"], .custom-form select {
  font: inherit; font-size: 0.9rem; padding: 6px 8px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--surface); color: var(--ink); width: 100%; min-width: 0;
}
.custom-actions { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.custom-import { display: grid; gap: 6px; margin: 8px 0; }
.custom-import .field { display: grid; gap: 4px; }
.custom-import .field > span { font-size: 0.78rem; color: var(--ink-faint); }
.custom-import textarea {
  width: 100%; font-family: var(--mono); font-size: 0.78rem; padding: 8px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink);
  resize: vertical; min-width: 0;
}
.custom-status { margin: 6px 0; font-size: 0.85rem; color: var(--ink-soft); min-height: 1.2em; }
.custom-list { display: grid; gap: 6px; }
.custom-row {
  display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: baseline;
  border-top: 1px solid var(--line); padding: 8px 0;
}
.custom-row .custom-code { font-family: var(--mono); font-weight: 600; font-size: 0.82rem; }
.custom-row .custom-name { flex: 1 1 220px; min-width: 0; overflow-wrap: anywhere; }
.custom-row .custom-meta { font-family: var(--mono); font-size: 0.75rem; color: var(--ink-soft); }
