:root {
  color-scheme: dark;
  --bg: #0b0e14;
  --surface: #141820;
  --surface-alt: #1e2430;
  --border: #2e3646;
  --text: #ffffff;
  --muted: #cbd5e1;
  --accent: #0063b1;
  --accent-strong: #004e8c;
  --safe: #22c55e;
  --warn: #f59e0b;
  --danger: #ef4444;
  --critical: #dc2626;
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.shield {
  font-size: 1.75rem;
}

.brand h1 {
  margin: 0;
  font-size: 1.25rem;
}

.subtitle {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.stats-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--muted);
}

.workspace-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 1.25rem;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.panel-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.panel-header h2 {
  margin: 0;
  font-size: 1rem;
}

.panel-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

textarea {
  width: 100%;
  background: var(--surface-alt);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  resize: vertical;
}

textarea:focus-visible,
button:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.sample-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.btn {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.45rem 0.85rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--surface-alt);
  color: var(--text);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: #ffffff;
}

.btn-secondary {
  background: var(--surface-alt);
}

.btn-ghost {
  background: transparent;
}

.badge {
  display: inline-block;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.badge-neutral { background: #334155; color: #f8fafc; }
.badge-safe { background: rgba(34, 197, 94, 0.2); color: var(--safe); }
.badge-warn { background: rgba(245, 158, 11, 0.2); color: var(--warn); }
.badge-danger { background: rgba(239, 68, 68, 0.2); color: var(--danger); }

.risk-meter-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.risk-meter-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
}

progress {
  width: 100%;
  height: 10px;
  border-radius: 999px;
}

.field-label {
  font-size: 0.85rem;
  font-weight: 600;
}

.muted {
  color: var(--muted);
  font-size: 0.85rem;
}

.checkbox-inline,
.select-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.875rem;
}

.policy-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  align-items: center;
}

select {
  background: var(--surface-alt);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.3rem 0.5rem;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

th,
td {
  text-align: left;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

th {
  color: var(--muted);
  font-weight: 600;
}

.empty-cell {
  text-align: center;
  color: var(--muted);
  padding: 1.25rem;
}

dialog {
  max-width: 720px;
  width: 92vw;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.65);
}

.dialog-header,
.dialog-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.code-block {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  max-height: 280px;
}

