/* CCSearch console. No external fonts or assets (strict CSP, PCI DSS 6.4.3-friendly). */
:root {
  --paper: #eef1f0;
  --surface: #ffffff;
  --ink: #172026;
  --muted: #5a6670;
  --line: #d6dcda;
  --line-soft: #e7ebea;
  --accent: #0e5c63;
  --accent-ink: #ffffff;
  --accent-soft: #e2efef;
  --risk: #b8401f;
  --risk-soft: #fbece6;
  --fp: #645a8c;
  --fp-soft: #eeecf5;
  --ok: #2e7046;
  --ok-soft: #e6f2ea;
  --warn: #8a5a00;
  --warn-soft: #fbf1dc;
  --sans: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, "Liberation Mono", monospace;
  --rail: 232px;
  --radius-sm: 4px;
  --radius: 8px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 15px/1.5 var(--sans);
  color: var(--ink);
  background: var(--paper);
  font-variant-numeric: tabular-nums;
}
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid #3a8f96; outline-offset: 2px; border-radius: 2px; }
h1, h2, h3 { line-height: 1.25; margin: 0; }
h1 { font-size: 1.6rem; font-weight: 650; letter-spacing: -0.01em; }
h2 { font-size: 1.05rem; font-weight: 650; }
h3 { font-size: 0.95rem; font-weight: 650; }
p { margin: 0 0 0.75rem; max-width: 72ch; }
code, .mono { font-family: var(--mono); font-size: 0.86em; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.nowrap { white-space: nowrap; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ------------------------------------------------------------ shell */
.shell { display: grid; grid-template-columns: var(--rail) 1fr; min-height: 100vh; }
.rail {
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); padding: 0 8px; }
.brand-mark {
  width: 30px; height: 20px; border-radius: 3px; background: var(--accent);
  position: relative; flex: none;
}
.brand-mark::after { /* magnetic stripe */
  content: ""; position: absolute; left: 0; right: 0; top: 5px; height: 4px; background: #0a3f44;
}
.brand-name { font-weight: 700; font-size: 1.05rem; letter-spacing: -0.01em; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 10px; border-radius: var(--radius-sm); color: var(--ink); text-decoration: none; font-weight: 500;
}
.nav a:hover { background: var(--paper); }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 650; }
.nav-group { margin-top: 14px; padding: 0 10px 4px; font-size: 0.78rem; color: var(--muted); }
.rail-foot { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid var(--line-soft); font-size: 0.85rem; }
.rail-foot form { margin-top: 6px; }
.linklike { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }

.topbar { display: none; }
.main { padding: 28px 32px 64px; min-width: 0; max-width: 1360px; }

/* ------------------------------------------------------------ page header */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; margin-bottom: 20px; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.crumbs { font-size: 0.85rem; margin-bottom: 6px; }

/* ------------------------------------------------------------ flash */
.flash { padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 18px; border-left: 4px solid; background: var(--surface); }
.flash-success { border-color: var(--ok); background: var(--ok-soft); }
.flash-error { border-color: var(--risk); background: var(--risk-soft); }
.errors { margin: 0 0 16px; padding: 10px 14px 10px 32px; background: var(--risk-soft); border-left: 4px solid var(--risk); border-radius: var(--radius-sm); }

/* ------------------------------------------------------------ ledger strip (KPIs) */
.ledger {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  margin-bottom: 24px;
}
.ledger > div { padding: 16px 18px; border-right: 1px solid var(--line-soft); }
.ledger > div:last-child { border-right: 0; }
.ledger .value { font-size: 1.9rem; font-weight: 650; line-height: 1.1; letter-spacing: -0.02em; }
.ledger .value a { color: inherit; text-decoration: none; }
.ledger .value a:hover { text-decoration: underline; }
.ledger .label { color: var(--muted); font-size: 0.86rem; margin-top: 4px; }
.ledger .risk .value { color: var(--risk); }

/* ------------------------------------------------------------ panels & grids */
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 20px; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line-soft); }
.panel-head p { margin: 2px 0 0; color: var(--muted); font-size: 0.86rem; }
.panel-body { padding: 16px 18px; }
.empty { padding: 22px 18px; color: var(--muted); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 20px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 18px; border-top: 1px solid var(--line-soft); }
.list li:first-child { border-top: 0; }

meter.bar { width: 100%; height: 8px; display: block; margin-top: 4px; }
meter.bar::-webkit-meter-bar { background: var(--line-soft); border: 0; border-radius: 4px; }
meter.bar::-webkit-meter-optimum-value { background: var(--accent); border-radius: 4px; }
meter.bar::-moz-meter-bar { background: var(--accent); border-radius: 4px; }

/* ------------------------------------------------------------ PAN chip (signature element) */
.pan {
  display: inline-flex; gap: 0.55em; align-items: center;
  font-family: var(--mono); font-size: 0.92rem; font-weight: 600; letter-spacing: 0.06em;
  padding: 3px 8px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: linear-gradient(#fbfcfc, #f1f4f3);
  box-shadow: inset 0 -1px 0 #dfe5e3;
  white-space: nowrap; color: var(--ink);
}
.pan-mask { color: #9aa5ac; letter-spacing: 0.02em; }
.brand-tag { display: inline-block; min-width: 3.3em; font-size: 0.72rem; font-weight: 700; color: var(--muted); letter-spacing: 0.04em; }

/* ------------------------------------------------------------ badges */
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 0.8rem; font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.badge-open { background: var(--risk-soft); color: var(--risk); }
.badge-false_positive { background: var(--fp-soft); color: var(--fp); }
.badge-resolved, .badge-completed { background: var(--ok-soft); color: var(--ok); }
.badge-partial, .badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-failed, .badge-revoked { background: var(--risk-soft); color: var(--risk); }
.badge-neutral { background: var(--paper); color: var(--muted); border-color: var(--line); }
.badge-test { background: #eef3fb; color: #2b4f86; }

/* ------------------------------------------------------------ tabs & filters */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tabs a { padding: 8px 12px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500; }
.tabs a[aria-current="page"] { color: var(--ink); border-color: var(--accent); font-weight: 650; }
.tabs .count { color: var(--muted); font-weight: 400; margin-left: 4px; }

.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 14px; }
.filters .field { min-width: 150px; }
.filters .grow { flex: 1 1 240px; }

/* ------------------------------------------------------------ forms */
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 0; }
.field label, .label-text { font-size: 0.85rem; font-weight: 600; }
.hint { font-size: 0.82rem; color: var(--muted); }
input[type=text], input[type=password], input[type=search], input[type=number], select, textarea {
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid #b9c3c0; border-radius: var(--radius-sm); padding: 7px 10px; min-height: 38px; width: 100%;
}
textarea { font-family: var(--mono); font-size: 0.85rem; line-height: 1.45; min-height: 260px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
.stack > * + * { margin-top: 14px; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 650; margin-bottom: 8px; padding: 0; }
.choice { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: 6px; cursor: pointer; }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice input { margin-top: 4px; }
.choice small { display: block; color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 600; font-size: 0.92rem; line-height: 1;
  padding: 10px 14px; min-height: 38px; border-radius: var(--radius-sm);
  border: 1px solid #b9c3c0; background: var(--surface); color: var(--ink); cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--paper); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: #0b4a50; }
.btn-danger { color: var(--risk); border-color: #e2b6a8; }
.btn-danger:hover { background: var(--risk-soft); }
.btn-small { padding: 6px 10px; min-height: 30px; font-size: 0.85rem; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.inline-form { display: inline; }

/* ------------------------------------------------------------ data tables */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
table.data th { text-align: left; font-size: 0.8rem; font-weight: 600; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data td { padding: 10px 12px; border-top: 1px solid var(--line-soft); vertical-align: top; }
table.data tr:first-child td { border-top: 0; }
table.data tbody tr:hover { background: #f8faf9; }
td.path { font-family: var(--mono); font-size: 0.82rem; overflow-wrap: anywhere; min-width: 240px; }
td.num, th.num { text-align: right; }
td.check, th.check { width: 36px; }

/* Status rail: a 3 px left edge carries the finding's state at a glance. */
tr.rail-open td:first-child { box-shadow: inset 3px 0 0 var(--risk); }
tr.rail-false_positive td:first-child { box-shadow: inset 3px 0 0 var(--fp); }
tr.rail-resolved td:first-child { box-shadow: inset 3px 0 0 var(--ok); }

.spread { font-size: 0.8rem; color: var(--muted); }
.spread strong { color: var(--ink); font-weight: 600; }

/* ------------------------------------------------------------ bulk false-positive bar */
.bulk {
  position: sticky; bottom: 0; z-index: 5;
  background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--fp);
  border-radius: var(--radius) var(--radius) 0 0; padding: 14px 18px; margin-top: 12px;
  box-shadow: 0 -6px 18px rgba(23, 32, 38, 0.08);
}
.bulk[hidden] { display: none; }
.bulk-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px 24px; }
.bulk-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; }

/* ------------------------------------------------------------ pager */
.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--line-soft); font-size: 0.88rem; }

/* ------------------------------------------------------------ auth pages */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; }
.auth-card .brand { padding: 0; margin-bottom: 22px; }
.auth-card h1 { font-size: 1.3rem; margin-bottom: 6px; }

.secret-box { font-family: var(--mono); font-size: 1rem; letter-spacing: 0.08em; padding: 12px; background: var(--paper); border: 1px dashed var(--line); border-radius: var(--radius-sm); overflow-wrap: anywhere; }
.reveal { border: 2px solid var(--warn); background: var(--warn-soft); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 20px; }
pre.log { font-family: var(--mono); font-size: 0.8rem; background: var(--paper); padding: 12px; border-radius: var(--radius-sm); overflow-x: auto; margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }

/* ------------------------------------------------------------ responsive */
@media (max-width: 1100px) {
  .grid-2, .bulk-grid { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .shell { display: block; }
  .topbar {
    display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: 20; background: var(--surface);
    border-bottom: 1px solid var(--line); padding: 10px 16px;
  }
  .rail { display: none; position: fixed; inset: 53px 0 0 0; height: auto; z-index: 19; border-right: 0; overflow-y: auto; }
  body.nav-open .rail { display: flex; }
  .main { padding: 20px 16px 48px; }
  h1 { font-size: 1.35rem; }
  .ledger { grid-template-columns: repeat(2, 1fr); }
  .ledger > div { border-bottom: 1px solid var(--line-soft); }

  /* Data tables become stacked records on narrow screens. */
  table.data.stack-sm thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  table.data.stack-sm, table.data.stack-sm tbody, table.data.stack-sm tr, table.data.stack-sm td { display: block; width: 100%; }
  table.data.stack-sm tr { border-top: 1px solid var(--line); padding: 8px 0; }
  table.data.stack-sm td { border: 0; padding: 4px 14px; display: grid; grid-template-columns: 7.5rem 1fr; gap: 10px; }
  table.data.stack-sm td::before { content: attr(data-label); color: var(--muted); font-size: 0.8rem; font-weight: 600; }
  table.data.stack-sm td.check::before { content: "Select"; }
  table.data.stack-sm td.path { min-width: 0; }
  table.data.stack-sm td.num { text-align: left; }
  tr.rail-open td:first-child, tr.rail-false_positive td:first-child, tr.rail-resolved td:first-child { box-shadow: none; }
  tr.rail-open { box-shadow: inset 4px 0 0 var(--risk); }
  tr.rail-false_positive { box-shadow: inset 4px 0 0 var(--fp); }
  tr.rail-resolved { box-shadow: inset 4px 0 0 var(--ok); }
  .bulk { border-radius: 0; margin-left: -16px; margin-right: -16px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

@media print {
  .rail, .topbar, .bulk, .actions, .filters, .pager form { display: none !important; }
  .shell { display: block; }
  body { background: #fff; }
}

textarea.plain { font-family: var(--sans); font-size: 0.92rem; min-height: 76px; }
.list .grow { flex: 1 1 auto; min-width: 0; }

/* Review fixes */
.grid-2 { margin-bottom: 20px; }
.grid-2 > .panel { margin-bottom: 0; }
.panel-head > a { white-space: nowrap; }
.bulk { max-height: 58vh; overflow-y: auto; }
.bulk-head > span { display: inline-flex; gap: 12px; align-items: baseline; flex-wrap: wrap; justify-content: flex-end; }
td[data-label="Card"] { white-space: nowrap; }
td[data-label="Host"] { white-space: nowrap; }
@media (max-width: 860px) {
  .bulk { position: static; max-height: none; box-shadow: none; }
  td[data-label="Card"], td[data-label="Host"] { white-space: normal; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; }
  .tabs a { white-space: nowrap; }
}
@media (max-width: 860px) {
  table.data.stack-sm td { display: block; padding: 5px 14px; }
  table.data.stack-sm td::before { display: block; margin-bottom: 2px; }
  table.data.stack-sm td.check { display: flex; gap: 10px; align-items: center; }
  table.data.stack-sm td.check::before { display: inline; margin: 0; }
}
