:root {
  --bg: #f5f6f8; --panel: #fff; --ink: #1b1f24; --muted: #66707c; --line: #e3e6ea;
  --accent: #1f5eff; --ok: #157347; --warn: #b26a00; --bad: #c62828; --radius: 10px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 14px; }
.hidden { display: none !important; }
button { font: inherit; border: 0; border-radius: 8px; padding: 8px 14px; background: var(--accent); color: #fff; cursor: pointer; }
button.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
button.danger { background: var(--bad); }
button.ok { background: var(--ok); }
button:disabled { opacity: .5; cursor: default; }
input, select, textarea { font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; width: 100%; background: #fff; }
label { display: grid; gap: 6px; margin-bottom: 12px; color: var(--muted); }
.login { min-height: 100vh; display: grid; place-items: center; }
.login .card { width: min(420px, 92vw); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.error { color: var(--bad); min-height: 1em; }
.shell { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; }
.sidebar { background: #111827; color: #cbd5e1; padding: 18px 12px; display: flex; flex-direction: column; gap: 12px; }
.brand { color: #fff; font-weight: 700; letter-spacing: .04em; padding: 0 8px 8px; }
.brand span { display: block; font-size: 11px; color: #94a3b8; font-weight: 500; }
#menu { list-style: none; margin: 0; padding: 0; flex: 1; overflow: auto; }
#menu a { display: block; padding: 8px 10px; border-radius: 8px; color: inherit; text-decoration: none; }
#menu a.active, #menu a:hover { background: #1f2937; color: #fff; }
#menu a.stop { color: #fca5a5; }
main { padding: 20px 24px; min-width: 0; }
.topbar { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.topbar h2 { margin: 0; }
.banner { background: #fdecea; color: var(--bad); padding: 8px 12px; border-radius: 8px; font-weight: 600; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); margin-bottom: 16px; }
.kpi .label { color: var(--muted); font-size: 12px; }
.kpi .value { font-size: 26px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .note { color: var(--muted); font-size: 12px; margin-top: 4px; }
table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #fafbfc; color: var(--muted); font-weight: 600; font-size: 12px; }
td code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; background: #eef2f7; color: var(--muted); }
.pill.SUCCEEDED, .pill.active, .pill.healthy, .pill.configured, .pill.APPROVED, .pill.CONSUMED { background: #e6f4ea; color: var(--ok); }
.pill.FAILED, .pill.paused, .pill.blocked, .pill.REJECTED, .pill.critical, .pill.high { background: #fdecea; color: var(--bad); }
.pill.WAITING_FOR_APPROVAL, .pill.WAITING_FOR_DEPENDENCY, .pill.PENDING, .pill.not_configured, .pill.missing, .pill.medium { background: #fff4e5; color: var(--warn); }
.chat { display: grid; grid-template-rows: 1fr auto; height: calc(100vh - 120px); gap: 12px; }
.messages { overflow: auto; display: flex; flex-direction: column; gap: 10px; padding-right: 6px; }
.msg { max-width: 760px; padding: 10px 14px; border-radius: 12px; white-space: pre-wrap; line-height: 1.45; }
.msg.owner { align-self: flex-end; background: var(--accent); color: #fff; }
.msg.director { align-self: flex-start; background: var(--panel); border: 1px solid var(--line); }
.msg .meta { font-size: 11px; opacity: .75; margin-top: 6px; }
.composer { display: flex; gap: 8px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.section { margin-bottom: 20px; }
.section h3 { margin: 0 0 8px; font-size: 15px; }
.muted { color: var(--muted); }
.toast { position: fixed; bottom: 20px; right: 20px; background: #111827; color: #fff; padding: 10px 14px; border-radius: 8px; max-width: 420px; }
pre { white-space: pre-wrap; background: #fafbfc; border: 1px solid var(--line); padding: 10px; border-radius: 8px; margin: 0; }
@media (max-width: 800px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; overflow-x: auto; padding: 8px; }
  #menu { display: flex; }
  .brand, #logout { display: none; }
  main { padding: 14px; }
}
