/* CloakDB Studio: security-print palette (ID cards, banknotes). */
:root {
  --paper: #ecefea;
  --sheet: #f7f8f5;
  --ink: #1d2b3a;
  --ink-soft: #4b5a68;
  --ink-faint: #7b8792;
  --rule: #cdd5cf;
  --guilloche: #2f6f6a;
  --fpe: #5b3fa8;
  --fake: #8e2f5a;
  --token: #2f6f6a;
  --erase: #7a848c;
  --numeric: #9a5b13;
  --keep: #b9c2bc;
  --high: #b42318;
  --medium: #a45d00;
  --good: #2f6f4f;
  --ui: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --data: ui-monospace, "Cascadia Mono", "SF Mono", "JetBrains Mono", Consolas, monospace;
  --r: 3px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: var(--paper);
  color: var(--ink);
  font: 14px/1.45 var(--ui);
  font-feature-settings: "tnum" 1;
}
h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.005em; }
h2 { font-size: 15px; }
h3 { font-size: 14px; }
code, .data { font-family: var(--data); font-size: 12.5px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Header */
.bar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 10px 20px; background: var(--ink); color: var(--sheet);
}
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.brand .rosette { width: 34px; height: 34px; }
.brand .rosette path { stroke: #9fd0c9; }
.brand-name { font-size: 17px; font-weight: 600; letter-spacing: 0.01em; }
.brand-name span { font-weight: 400; color: #b8c7c4; }
.files { display: flex; flex-wrap: wrap; gap: 6px; }

button, .button {
  appearance: none; display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--rule); border-radius: var(--r);
  background: var(--sheet); color: var(--ink);
  font: inherit; font-size: 13px; padding: 5px 11px; cursor: pointer;
}
.bar button, .bar .button { background: transparent; color: var(--sheet); border-color: #3d4e5f; }
.bar button:hover, .bar .button:hover { border-color: #9fd0c9; }
button.primary { background: #9fd0c9; color: var(--ink); border-color: #9fd0c9; font-weight: 600; }
button:disabled { opacity: 0.45; cursor: not-allowed; }
.button input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.button { position: relative; }
:focus-visible, .button:focus-within { outline: 2px solid var(--guilloche); outline-offset: 2px; }
.bar :focus-visible, .bar .button:focus-within { outline-color: #9fd0c9; }

/* Workspace */
.workspace {
  display: grid; grid-template-columns: minmax(380px, 34%) 1fr;
  gap: 1px; background: var(--rule); min-height: 0;
}
.pane { background: var(--sheet); display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.pane-head {
  display: flex; align-items: flex-end; gap: 18px; padding: 12px 18px 0;
  border-bottom: 1px solid var(--rule); background: var(--paper);
}
.pane-head h2 { padding-bottom: 9px; }
.tabs { display: flex; gap: 2px; }
[role=tab] {
  border: 0; border-bottom: 2px solid transparent; border-radius: 0;
  background: none; padding: 7px 10px 8px; color: var(--ink-soft);
}
[role=tab][aria-selected=true] { color: var(--ink); border-bottom-color: var(--ink); font-weight: 600; }
.count:empty { display: none; }
.count { font-size: 11px; padding: 0 6px; border-radius: 8px; background: var(--rule); color: var(--ink); font-weight: 600; }
.count.high { background: var(--high); color: #fff; }
.count.medium { background: var(--medium); color: #fff; }
[role=tabpanel] { overflow: auto; flex: 1; padding: 16px 18px 24px; min-height: 0; }
.status-line { margin: 0; padding: 8px 18px; border-top: 1px solid var(--rule); font-size: 12.5px; color: var(--ink-soft); min-height: 36px; }
.status-line.error, .error-text { color: var(--high); }

/* Rules editor */
.risk-settings { display: flex; align-items: center; gap: 8px; margin: 0 0 14px; font-size: 13px; color: var(--ink-soft); }
.risk-settings input { width: 56px; }
.table-rules { margin-bottom: 20px; }
.table-rules h3 { display: flex; justify-content: space-between; align-items: baseline; padding-bottom: 6px; border-bottom: 1px solid var(--ink); }
.table-rules h3 small { font-weight: 400; color: var(--ink-faint); font-size: 12px; }
.column-rule {
  display: grid; grid-template-columns: 4px 1fr auto; gap: 4px 10px;
  padding: 8px 0; border-bottom: 1px solid var(--rule); align-items: start;
}
.swatch { grid-row: 1 / span 2; align-self: stretch; border-radius: 2px; background: var(--keep); }
.column-name { font-family: var(--data); font-size: 13px; overflow-wrap: anywhere; }
.column-meta { font-size: 12px; color: var(--ink-faint); }
.column-controls { grid-column: 2 / span 2; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.qi { grid-column: 3; grid-row: 1; font-size: 12px; color: var(--ink-soft); display: flex; gap: 4px; align-items: center; }
select, input[type=text], input[type=number] {
  font: inherit; font-size: 13px; padding: 4px 6px; border: 1px solid var(--rule);
  border-radius: var(--r); background: #fff; color: var(--ink); min-width: 0;
}
.column-controls input[type=text] { width: 9.5em; font-family: var(--data); font-size: 12.5px; }
.column-controls label { display: inline-flex; gap: 4px; align-items: center; font-size: 12px; color: var(--ink-soft); }
.uncovered .swatch { background: var(--high); }
#yaml {
  width: 100%; height: 100%; min-height: 420px; resize: none; border: 1px solid var(--rule); border-radius: var(--r);
  font: 13px/1.55 var(--data); padding: 12px; color: var(--ink); background: #fff; tab-size: 2; white-space: pre; overflow: auto;
}

/* Rule families: one ink each, used for swatches, chips and changed cells. */
.f-keep { --family: var(--keep); }
.f-fpe { --family: var(--fpe); }
.f-fake { --family: var(--fake); }
.f-token { --family: var(--token); }
.f-erase { --family: var(--erase); }
.f-numeric { --family: var(--numeric); }
.swatch[class*=" f-"], .chip { background: var(--family); }
.chip { color: #fff; font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 2px; white-space: nowrap; }
.chip.f-keep { color: var(--ink); }

/* Empty state: the single decorative moment. */
.empty { display: grid; place-items: center; text-align: center; padding: 40px 16px; color: var(--ink-soft); }
.empty .rosette { width: min(300px, 70vw); height: auto; margin-bottom: 18px; }
.empty .rosette path { stroke: var(--guilloche); }
.empty .rosette path + path { stroke: var(--fpe); opacity: 0.55; }
.empty h3 { font-size: 20px; color: var(--ink); font-weight: 600; margin-bottom: 6px; }
.empty p { max-width: 52ch; margin: 0 auto 16px; }
.empty .actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
@media (prefers-reduced-motion: no-preference) {
  .empty .rosette path { stroke-dasharray: 2400; stroke-dashoffset: 2400; animation: draw 2.4s ease-out forwards; }
  .empty .rosette path + path { animation-delay: 0.5s; }
}
@keyframes draw { to { stroke-dashoffset: 0; } }

/* Preview */
.run-summary { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: baseline; margin: 0 0 16px; }
.run-summary strong { font-size: 15px; }
.run-summary .muted { color: var(--ink-faint); font-size: 12.5px; }
.toggle { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; margin-left: auto; }
.rejected { border-left: 3px solid var(--high); padding: 8px 12px; background: #fbeceb; margin-bottom: 16px; }
.block { margin-bottom: 26px; }
.block h3 { margin-bottom: 8px; display: flex; gap: 10px; align-items: baseline; }
.block h3 small { font-weight: 400; color: var(--ink-faint); font-size: 12px; }
.grid-wrap { overflow-x: auto; border: 1px solid var(--rule); border-radius: var(--r); background: #fff; }
table.grid { border-collapse: collapse; width: max-content; min-width: 100%; }
.grid th, .grid td { padding: 6px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid #e4e8e4; }
.grid th { position: sticky; top: 0; background: var(--sheet); font-weight: 600; font-size: 12.5px; border-bottom: 2px solid var(--family, var(--rule)); }
.grid th .chip { margin-left: 6px; vertical-align: 1px; }
.grid td { font-family: var(--data); font-size: 12.5px; white-space: nowrap; max-width: 36ch; overflow: hidden; text-overflow: ellipsis; }
.grid td.changed { box-shadow: inset 2px 0 0 var(--family); }
.grid td .was { display: block; color: var(--ink-faint); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--family) 70%, transparent); font-size: 11.5px; }
.hide-source .was { display: none; }
.null { color: var(--ink-faint); font-style: italic; }
.more { font-size: 12px; color: var(--ink-faint); margin: 6px 0 0; }

/* Plan and risk */
.verdict { display: flex; gap: 10px; align-items: baseline; margin: 0 0 16px; font-size: 15px; font-weight: 600; }
.verdict.good { color: var(--good); }
.verdict.bad { color: var(--high); }
.issues { list-style: none; margin: 0; padding: 0; }
.issues li { padding: 9px 0 9px 12px; border-bottom: 1px solid var(--rule); border-left: 3px solid var(--high); margin-bottom: 4px; }
.issues li.medium { border-left-color: var(--medium); }
.issues li.info { border-left-color: var(--erase); }
.issues .where { font-family: var(--data); font-size: 12.5px; }
.issues p { margin: 2px 0 0; color: var(--ink-soft); max-width: 75ch; }
.risk-table { margin: 24px 0 0; }
.risk-table h3 { padding-bottom: 6px; border-bottom: 1px solid var(--ink); margin-bottom: 10px; }
.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px 24px; margin: 0 0 14px; }
.figures div { display: flex; flex-direction: column; }
.figures dt { font-size: 12px; color: var(--ink-faint); order: 2; }
.figures dd { margin: 0; font-size: 22px; font-weight: 600; order: 1; }
.figures dd.bad { color: var(--high); }
.distinct { display: grid; grid-template-columns: minmax(120px, 14em) 1fr 7.5em; gap: 6px 12px; align-items: center; font-size: 12.5px; }
.distinct .bar-track { height: 8px; background: #e4e8e4; border-radius: 4px; overflow: hidden; }
.distinct .bar-fill { height: 100%; background: var(--ink-soft); }
.distinct .linkage .bar-fill { background: var(--high); }
.distinct .name { font-family: var(--data); }
.distinct .pct { text-align: right; color: var(--ink-soft); white-space: nowrap; }
.note { color: var(--ink-faint); font-size: 12.5px; max-width: 75ch; }

/* Verify */
.verify-form { margin-bottom: 18px; }
.verify-form p { margin: 0 0 10px; color: var(--ink-soft); max-width: 75ch; }
.verify-form .actions { display: flex; flex-wrap: wrap; gap: 8px; }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; }
dl.facts dt { color: var(--ink-faint); font-size: 12.5px; }
dl.facts dd { margin: 0; font-family: var(--data); font-size: 12.5px; overflow-wrap: anywhere; }

.foot {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px;
  padding: 7px 20px; font-size: 12px; color: var(--ink-soft); border-top: 1px solid var(--rule); background: var(--paper);
}
#engine-status.error { color: var(--high); }

@media (max-width: 960px) {
  .workspace { grid-template-columns: 1fr; }
  .bar { flex-direction: column; align-items: flex-start; }
  [role=tabpanel] { overflow: visible; }
  body { display: block; }
}
