:root {
  --navy: #003876;
  --blue: #0066cc;
  --slate-bg: #f1f5f9;
  --card-bg: #ffffff;
  --border: #cbd5e1;
  --text: #0f172a;
  --muted: #475569;
  --green: #047857;
  --green-bg: #d1fae5;
  --red: #b91c1c;
  --red-bg: #fee2e2;
  --amber: #b45309;
  --amber-bg: #fef3c7;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--slate-bg);
  color: var(--text);
  line-height: 1.45;
}

.topbar {
  background: linear-gradient(135deg, var(--navy), #00234d);
  color: #fff;
  padding: 16px 20px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}
.topbar-inner {
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-dot {
  width: 14px; height: 14px; border-radius: 50%;
  background: #38bdf8; box-shadow: 0 0 12px #38bdf8;
  flex-shrink: 0;
}
.topbar h1 { margin: 0; font-size: 1.25rem; letter-spacing: -0.01em; }
.subtitle { margin: 2px 0 0; font-size: 0.82rem; color: #cbd5e1; }
.cloud-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badge {
  font-size: 0.72rem; font-weight: 600; padding: 4px 10px;
  border-radius: 999px; border: 1px solid rgba(255,255,255,0.22);
}
.badge-azure { background: rgba(0, 120, 212, 0.35); }
.badge-gcp { background: rgba(52, 168, 83, 0.32); }
.badge-sec { background: rgba(245, 158, 11, 0.28); }

.container {
  max-width: 1080px;
  margin: 18px auto 40px;
  padding: 0 14px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.card-head h2 { margin: 0; font-size: 1.05rem; color: var(--navy); }
.hint { font-size: 0.78rem; color: var(--muted); }

.controls-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
}
.field { display: flex; flex-direction: column; gap: 4px; font-size: 0.82rem; font-weight: 600; color: var(--muted); }
.field-grow { flex: 1 1 240px; }
.field select, .field input {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 0.95rem;
  color: var(--text);
  background: #fff;
}

.action-buttons { display: flex; flex-wrap: wrap; gap: 10px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 11px 16px; border-radius: 10px; font-size: 0.92rem;
  font-weight: 600; cursor: pointer; border: 1px solid transparent;
  transition: transform 0.08s ease, opacity 0.15s ease;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--navy); color: #fff; }
.btn-outline { background: #fff; color: var(--navy); border-color: var(--navy); }
.btn-subtle { background: #e2e8f0; color: var(--text); }
.btn-sm { padding: 6px 12px; font-size: 0.82rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

.preview-box {
  margin-top: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  background: #f8fafc;
  text-align: center;
}
.preview-box img { max-width: 100%; max-height: 280px; border-radius: 8px; object-fit: contain; }
.preview-caption { margin: 8px 0 0; font-size: 0.82rem; color: var(--muted); }
.hidden { display: none; }

.scenario-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}
.scenario-btn {
  text-align: left;
  padding: 14px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: #fff;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.scenario-btn:disabled { opacity: 0.55; cursor: wait; }
.scenario-allow:hover { border-color: var(--green); background: #f0fdf4; }
.scenario-deny:hover { border-color: var(--red); background: #fef2f2; }
.scenario-btn strong { font-size: 0.96rem; color: var(--text); }
.scenario-btn small { font-size: 0.78rem; color: var(--muted); }

.pill {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  width: fit-content;
}
.pill-allow { background: var(--green-bg); color: var(--green); }
.pill-deny { background: var(--red-bg); color: var(--red); }
.pill-warn { background: var(--amber-bg); color: var(--amber); }
.pill-neutral { background: #e2e8f0; color: var(--muted); }

.meta-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.result-body {
  margin: 0;
  padding: 14px;
  background: #0f172a;
  color: #f8fafc;
  border-radius: 10px;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85rem;
  max-height: 360px;
  overflow-y: auto;
}
.tools-used { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }

.ledger-summary { margin: 0 0 10px; font-size: 0.86rem; color: var(--muted); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid #e2e8f0; }
th { background: #f8fafc; color: var(--navy); font-weight: 700; }
