* { box-sizing: border-box; margin: 0; }

body {
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
  background: #12151c;
  color: #e6e9ef;
  min-height: 100vh;
}

header {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 14px 22px;
  background: #1a1f2b;
  border-bottom: 1px solid #2b3245;
}
header h1 { font-size: 22px; }
.subtitle { color: #8b93a7; font-size: 13px; flex: 1; }
#user-box { font-size: 13px; color: #8b93a7; }
#user-box button {
  margin-left: 8px; background: none; border: 1px solid #3a415a;
  color: #8b93a7; border-radius: 5px; padding: 2px 8px; cursor: pointer;
}

.hidden { display: none !important; }
.centered { display: flex; flex-direction: column; align-items: center;
            gap: 16px; padding-top: 12vh; }
.error { color: #ff7a7a; }
.muted { color: #8b93a7; font-weight: normal; font-size: 13px; }

#dashboard { padding: 20px 22px; }

.tiles { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.tile {
  background: #1a1f2b; border: 1px solid #2b3245; border-radius: 10px;
  padding: 12px 18px; min-width: 110px;
}
.tile .num { font-size: 26px; font-weight: 700; }
.tile .label { font-size: 12px; color: #8b93a7; margin-top: 2px; }
.tile.critical .num { color: #ff5d5d; }
.tile.high .num { color: #ffab4a; }
.tile.medium .num { color: #ffe066; }
.tile.info .num { color: #6ea8ff; }
.tile.ok .num { color: #55d187; }

.columns { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 1000px) { .columns { grid-template-columns: 1fr; } }

.panel {
  background: #1a1f2b; border: 1px solid #2b3245; border-radius: 10px;
  padding: 16px; overflow: hidden;
}
.panel h2 { font-size: 15px; margin-bottom: 10px; }

.table-wrap { overflow-x: auto; max-height: 560px; overflow-y: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid #262c3d; }
th { color: #8b93a7; font-weight: 600; position: sticky; top: 0; background: #1a1f2b; }
tr.acked { opacity: 0.45; }

.sev { font-size: 11px; padding: 2px 7px; border-radius: 9px; font-weight: 700;
       text-transform: uppercase; }
.sev.critical { background: #4a1d1d; color: #ff5d5d; }
.sev.high { background: #4a361d; color: #ffab4a; }
.sev.medium { background: #47421c; color: #ffe066; }
.sev.info { background: #1d2c4a; color: #6ea8ff; }

.check-tag { color: #8b93a7; font-size: 12px; }
.finding-key { color: #5d667e; font-size: 11px; display: block; margin-top: 2px;
               word-break: break-all; }

button.ack {
  background: #232a3b; border: 1px solid #3a415a; color: #c9d0e0;
  border-radius: 6px; padding: 3px 10px; cursor: pointer; font-size: 12px;
}
button.ack:hover { background: #2c3550; }

#report-md {
  white-space: pre-wrap; font-size: 12px; background: #12151c;
  border: 1px solid #262c3d; border-radius: 8px; padding: 12px;
  max-height: 420px; overflow: auto; margin-bottom: 16px;
}

#run-history { list-style: none; font-size: 13px; color: #8b93a7; }
#run-history li { padding: 3px 0; }

/* ── fleet chrome ─────────────────────────────────────────────────── */

.tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.tab {
  background: #1a1f2b; border: 1px solid #2b3245; color: #8b93a7;
  border-radius: 8px; padding: 6px 14px; cursor: pointer; font-size: 13px;
}
.tab:hover { background: #232a3b; }
.tab.active { background: #232a3b; color: #e6e9ef; border-color: #3a415a; }

#agent-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; }
#agent-head h2 { font-size: 18px; }
#global-actions { margin-left: auto; display: flex; gap: 6px; }

button.action {
  background: #232a3b; border: 1px solid #3a415a; color: #c9d0e0;
  border-radius: 6px; padding: 3px 10px; cursor: pointer; font-size: 12px;
  margin-left: 4px;
}
button.action:hover { background: #2c3550; }

.stack { display: flex; flex-direction: column; gap: 18px; }

#scheduled-list { list-style: none; font-size: 13px; }
#scheduled-list li { padding: 4px 0; border-bottom: 1px solid #262c3d; }
#scheduled-list li:last-child { border-bottom: none; }

/* ── chat ─────────────────────────────────────────────────────────── */

#chat-panel { margin-top: 18px; position: relative; }
/* Top-right of the panel, deliberately quiet: it throws away a conversation,
   so it should be findable but never the thing the eye lands on. */
#chat-reset {
  position: absolute; top: 14px; right: 14px;
  background: none; border: 1px solid #2a3145; border-radius: 4px;
  color: #8b93a7; font-size: 11px; padding: 3px 8px; cursor: pointer;
}
#chat-reset:hover { color: #e6e8ee; border-color: #3a4155; }
#chat-reset:disabled { opacity: 0.4; cursor: default; }
#chat-log {
  max-height: 340px; overflow-y: auto; display: flex; flex-direction: column;
  gap: 10px; margin-bottom: 12px;
}
.chat-turn { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; }
.chat-turn .who {
  color: #8b93a7; font-size: 11px; text-transform: uppercase; min-width: 58px;
  padding-top: 5px; flex-shrink: 0;
}
.chat-turn .bubble {
  background: #12151c; border: 1px solid #262c3d; border-radius: 8px;
  padding: 8px 12px; white-space: pre-wrap; flex: 1;
}
.chat-turn.user .bubble { background: #1d2436; }
.chat-turn.pending .bubble { color: #8b93a7; }
.chat-turn.chat-error .bubble { border-color: #4a1d1d; color: #ff7a7a; }

#chat-form { display: flex; gap: 8px; }
#chat-input {
  flex: 1; background: #12151c; border: 1px solid #2b3245; border-radius: 8px;
  color: #e6e9ef; padding: 8px 10px; font: inherit; font-size: 13px; resize: vertical;
}
#chat-send {
  background: #2c3550; border: 1px solid #3a415a; color: #e6e9ef;
  border-radius: 8px; padding: 0 18px; cursor: pointer; font-size: 13px;
}
#chat-send:disabled { opacity: 0.5; cursor: default; }
