/* =====================================================
   SIEM Dashboard — Unified Stylesheet
   ===================================================== */

:root {
  --sb-width: 210px;
  --sb-collapsed: 60px;
  --sb-bg: #0f172a;
  --sb-hover: #1e293b;
  --sb-active: #1d4ed8;
  --sb-text: #94a3b8;
  --sb-text-active: #ffffff;
  --accent: #0ea5e9;
  --accent2: #14b8a6;
  --db-bg: #f1f5f9;
  --card-bg: #ffffff;
  --card-shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --card-shadow-hover: 0 4px 12px rgba(0,0,0,.12);
  --border: #e2e8f0;
  --text1: #0f172a;
  --text2: #475569;
  --text3: #94a3b8;
  --crit: #ef4444;
  --high: #f97316;
  --med:  #f59e0b;
  --low:  #3b82f6;
  --info: #94a3b8;
  --radius: 10px;
  --header-h: 56px;
  --status-h: 30px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  color: var(--text1);
  background: var(--db-bg);
}

/* =====================================================
   LOGIN PAGE
   ===================================================== */

.login-body {
  background: var(--sb-bg);
  min-height: 100vh;
  display: flex;
  align-items: stretch;
}

.login-split {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

.login-brand {
  flex: 1;
  background: linear-gradient(145deg, #0f172a 0%, #1e3a5f 60%, #0d3b6e 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  position: relative;
  overflow: hidden;
}

.login-brand::before {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(14,165,233,.12) 0%, transparent 70%);
  top: -100px; left: -100px;
  pointer-events: none;
}

.login-brand::after {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(20,184,166,.10) 0%, transparent 70%);
  bottom: -50px; right: -50px;
  pointer-events: none;
}

.brand-inner { max-width: 420px; position: relative; z-index: 1; }

.brand-logo {
  width: 72px; height: 72px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
  border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px; color: #fff;
  margin-bottom: 28px;
  box-shadow: 0 8px 32px rgba(14,165,233,.35);
}

.brand-title { font-size: 32px; font-weight: 700; color: #fff; margin-bottom: 10px; }
.brand-sub   { color: #94a3b8; font-size: 15px; margin-bottom: 40px; line-height: 1.6; }

.brand-stats { display: flex; gap: 28px; margin-bottom: 36px; }
.bstat { display: flex; flex-direction: column; }
.bstat-num  { font-size: 24px; font-weight: 700; color: var(--accent); }
.bstat-lbl  { font-size: 12px; color: #64748b; text-transform: uppercase; letter-spacing: .05em; }

.brand-features { list-style: none; display: flex; flex-direction: column; gap: 12px; }
.brand-features li { color: #94a3b8; font-size: 14px; display: flex; align-items: center; gap: 10px; }
.brand-features li i { color: var(--accent2); width: 16px; }

.login-form-panel {
  width: 460px;
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  padding: 40px 48px;
}

.login-card { width: 100%; }

.lc-header { text-align: center; margin-bottom: 32px; }

.lc-icon {
  width: 56px; height: 56px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
  border-radius: 14px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 24px; color: #fff;
  margin-bottom: 16px;
  box-shadow: 0 4px 16px rgba(14,165,233,.3);
}

.lc-header h2 { font-size: 22px; font-weight: 700; color: var(--text1); margin-bottom: 6px; }
.lc-header p  { color: var(--text3); font-size: 14px; }

.lc-error {
  background: #fef2f2; border: 1px solid #fecaca; color: var(--crit);
  border-radius: 8px; padding: 10px 14px; margin-bottom: 20px;
  font-size: 13px; display: flex; align-items: center; gap: 8px;
}

.lc-field { margin-bottom: 18px; }
.lc-field label { display: block; font-size: 13px; font-weight: 500; color: var(--text2); margin-bottom: 6px; }

.lc-input-wrap { position: relative; display: flex; align-items: center; }
.lc-input-icon { position: absolute; left: 12px; color: var(--text3); font-size: 14px; pointer-events: none; }

.lc-input-wrap input,
.lc-field select,
.lc-field input[type="text"],
.lc-field input[type="email"],
.lc-field input[type="password"] {
  width: 100%; height: 42px; padding: 0 36px 0 38px;
  border: 1.5px solid var(--border); border-radius: 8px;
  font-size: 14px; font-family: inherit; color: var(--text1);
  transition: border-color .15s, box-shadow .15s;
  outline: none; background: #f8fafc;
}

.lc-field select { padding: 0 12px; cursor: pointer; }

.lc-input-wrap input:focus {
  border-color: var(--accent); background: #fff;
  box-shadow: 0 0 0 3px rgba(14,165,233,.12);
}

.lc-eye { position: absolute; right: 10px; background: none; border: none; cursor: pointer; color: var(--text3); padding: 4px; }
.lc-eye:hover { color: var(--text2); }

.lc-btn {
  width: 100%; height: 44px;
  background: linear-gradient(135deg, var(--accent) 0%, #0284c7 100%);
  color: #fff; border: none; border-radius: 8px;
  font-size: 15px; font-weight: 600; font-family: inherit; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: opacity .15s, transform .1s; margin-top: 8px;
}
.lc-btn:hover  { opacity: .92; transform: translateY(-1px); }
.lc-btn:active { transform: translateY(0); }

.lc-hint {
  margin-top: 20px; text-align: center; color: var(--text3); font-size: 12px;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.lc-hint strong { color: var(--text2); }

/* =====================================================
   DASHBOARD LAYOUT
   ===================================================== */

.db-body { display: flex; min-height: 100vh; }

/* ---- SIDEBAR ---- */
.sidebar {
  width: var(--sb-width);
  min-height: 100vh;
  background: var(--sb-bg);
  display: flex; flex-direction: column;
  position: fixed; left: 0; top: 0;
  z-index: 100;
  transition: width .2s ease;
  overflow: hidden;
}

.sidebar.collapsed { width: var(--sb-collapsed); }

.sidebar.collapsed .sb-logo-txt,
.sidebar.collapsed .sb-item > span,
.sidebar.collapsed .sb-badge,
.sidebar.collapsed .sb-user-info,
.sidebar.collapsed .sb-logout { display: none; }

.sb-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 16px; border-bottom: 1px solid #1e293b;
  height: var(--header-h); white-space: nowrap;
}
.sb-logo i { font-size: 22px; color: var(--accent); flex-shrink: 0; width: 28px; text-align: center; }
.sb-logo-txt { font-size: 18px; font-weight: 700; color: #fff; letter-spacing: .03em; }

.sb-nav { list-style: none; flex: 1; padding: 12px 0; overflow: hidden; }

.sb-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; cursor: pointer;
  color: var(--sb-text); border-radius: 8px;
  margin: 2px 8px;
  transition: background .15s, color .15s;
  white-space: nowrap; position: relative; user-select: none;
}
.sb-item:hover  { background: var(--sb-hover); color: #e2e8f0; }
.sb-item.active { background: var(--sb-active); color: var(--sb-text-active); }
.sb-item i      { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }
.sb-item span:first-of-type { font-size: 13.5px; font-weight: 500; }

.sb-badge {
  margin-left: auto; background: var(--crit); color: #fff;
  font-size: 10px; font-weight: 700; padding: 2px 6px;
  border-radius: 99px; min-width: 18px; text-align: center; display: none;
}
.sb-badge.show { display: inline-block; }

.sb-bottom { padding: 12px; border-top: 1px solid #1e293b; display: flex; align-items: center; gap: 8px; }

.sb-avatar {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff; font-size: 14px; flex-shrink: 0;
}

.sb-user-info { display: flex; flex-direction: column; overflow: hidden; flex: 1; }
.sb-uname { font-size: 13px; font-weight: 600; color: #e2e8f0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-role  { font-size: 11px; color: #64748b; text-transform: capitalize; }

.sb-logout { color: #64748b; text-decoration: none; font-size: 15px; padding: 6px; border-radius: 6px; transition: background .15s, color .15s; }
.sb-logout:hover { background: #1e293b; color: var(--crit); }

/* ---- MAIN CONTENT ---- */
.db-main {
  margin-left: var(--sb-width); flex: 1;
  display: flex; flex-direction: column;
  min-height: 100vh; transition: margin-left .2s ease;
}
.sidebar.collapsed ~ .db-main { margin-left: var(--sb-collapsed); }

/* ---- HEADER ---- */
.db-header {
  height: var(--header-h); background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 20px; gap: 16px;
  position: sticky; top: 0; z-index: 50;
}

.db-header-left   { display: flex; align-items: center; gap: 12px; }
.db-header-center { flex: 1; max-width: 480px; }
.db-header-right  { display: flex; align-items: center; gap: 10px; margin-left: auto; }

.sb-toggle { background: none; border: none; cursor: pointer; color: var(--text2); font-size: 16px; padding: 6px; border-radius: 6px; transition: background .15s; }
.sb-toggle:hover { background: var(--db-bg); }

.breadcrumb { display: flex; align-items: center; gap: 6px; color: var(--text3); font-size: 13px; }
.bc-home    { color: var(--text3); }
.bc-sep     { font-size: 10px; }
.bc-page    { color: var(--text2); font-weight: 500; }

.search-bar {
  display: flex; align-items: center; gap: 8px;
  background: #f8fafc; border: 1.5px solid var(--border);
  border-radius: 8px; padding: 0 12px; height: 36px;
}
.search-bar i        { color: var(--text3); font-size: 13px; }
.search-bar input    { border: none; background: none; outline: none; font-size: 13px; font-family: inherit; color: var(--text1); width: 100%; }
.search-bar input::placeholder { color: var(--text3); }

.time-badge {
  display: flex; align-items: center; gap: 6px;
  background: #f8fafc; border: 1.5px solid var(--border);
  border-radius: 8px; padding: 0 10px; height: 36px;
  font-size: 13px; color: var(--text2);
}
.time-badge i      { color: var(--text3); font-size: 12px; }
.time-badge select { border: none; background: none; outline: none; font-size: 13px; font-family: inherit; color: var(--text2); cursor: pointer; }

.btn-refresh {
  display: flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 14px;
  background: linear-gradient(135deg, var(--accent) 0%, #0284c7 100%);
  color: #fff; border: none; border-radius: 8px;
  font-size: 13px; font-weight: 600; font-family: inherit; cursor: pointer;
  transition: opacity .15s;
}
.btn-refresh:hover { opacity: .88; }

.btn-primary {
  display: flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 14px;
  background: linear-gradient(135deg, var(--accent2) 0%, #0d9488 100%);
  color: #fff; border: none; border-radius: 8px;
  font-size: 13px; font-weight: 600; font-family: inherit; cursor: pointer;
  transition: opacity .15s;
}
.btn-primary:hover { opacity: .88; }

#refreshIcon.spin { animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- PAGES ---- */
.page { display: none; padding: 20px; flex-direction: column; gap: 16px; padding-bottom: calc(var(--status-h) + 20px); }
.page.active { display: flex; }

.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.page-title  { font-size: 18px; font-weight: 700; color: var(--text1); display: flex; align-items: center; gap: 10px; }
.page-title i { color: var(--accent); }

/* ---- CARDS ---- */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  border: 1px solid var(--border);
  padding: 16px;
}

.card-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}

.card-title { font-size: 14px; font-weight: 600; color: var(--text2); display: flex; align-items: center; gap: 7px; }
.card-title i { color: var(--accent); }
.card-meta    { font-size: 12px; color: var(--text3); }

/* ---- KPI ROW ---- */
.kpi-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }

.kpi-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  border: 1px solid var(--border);
  padding: 16px 18px;
  display: flex; align-items: center; gap: 14px;
  transition: box-shadow .15s;
}
.kpi-card:hover { box-shadow: var(--card-shadow-hover); }

.kpi-icon { width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
.kpi-access   { background: #eff6ff; color: #3b82f6; }
.kpi-threat   { background: #fef2f2; color: var(--crit); }
.kpi-audit    { background: #f0fdf4; color: #16a34a; }
.kpi-endpoint { background: #fef3c7; color: var(--med); }
.kpi-total    { background: #f5f3ff; color: #7c3aed; }

.kpi-body { flex: 1; min-width: 0; }
.kpi-num  { font-size: 26px; font-weight: 700; color: var(--text1); line-height: 1.1; letter-spacing: -.02em; }
.kpi-lbl  { font-size: 12px; color: var(--text3); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- MID ROW ---- */
.mid-row { display: grid; grid-template-columns: 1fr 420px; gap: 14px; }

.chart-wrap { height: 220px; position: relative; }

/* ---- MAP — canvas-based, no image tiles ---- */
.map-wrap {
  height: 220px;
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  background: #f8fafc;
}

#attackerMap {
  width: 100%;
  height: 100%;
  display: block;
}

.map-no-data {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(248,250,252,0.92);
  color: var(--text3);
  font-size: 13px;
  text-align: center;
  padding: 16px;
}
.map-no-data i { font-size: 28px; color: var(--border); }

/* ---- BOTTOM ROW ---- */
.bot-row { display: grid; grid-template-columns: 1fr 340px; gap: 14px; }

.table-wrap { max-height: 280px; overflow-y: auto; }
.donut-wrap { height: 260px; position: relative; }

/* ---- TABLES ---- */
.siem-table { width: 100%; border-collapse: collapse; font-size: 13px; }

.siem-table thead th {
  text-align: left; padding: 8px 12px;
  color: var(--text3); font-weight: 600; font-size: 11px;
  text-transform: uppercase; letter-spacing: .06em;
  border-bottom: 1px solid var(--border); white-space: nowrap;
  background: #f8fafc;
}

.siem-table tbody tr { border-bottom: 1px solid #f1f5f9; transition: background .1s; }
.siem-table tbody tr:last-child { border-bottom: none; }
.siem-table tbody tr:hover { background: #f8fafc; }
.siem-table tbody td { padding: 8px 12px; color: var(--text1); vertical-align: middle; }

.full-table { min-width: 800px; }

.col-rule { width: 60%; }
.col-sev  { width: 20%; white-space: nowrap; }
.col-cnt  { width: 20%; text-align: right; font-weight: 600; color: var(--text2); }

/* ---- SEVERITY BADGES ---- */
.sev { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.sev-critical { background: #fef2f2; color: var(--crit); }
.sev-high     { background: #fff7ed; color: var(--high); }
.sev-medium   { background: #fffbeb; color: #d97706; }
.sev-low      { background: #eff6ff; color: var(--low); }
.sev-info     { background: #f8fafc; color: var(--text3); }

/* ---- DISPOSITION BADGES ---- */
.disp { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 600; text-transform: capitalize; }
.disp-open            { background: #fef2f2; color: var(--crit); }
.disp-investigating   { background: #fff7ed; color: var(--high); }
.disp-true_positive   { background: #f0fdf4; color: #16a34a; }
.disp-false_positive  { background: #f8fafc; color: var(--text3); }
.disp-closed          { background: #f1f5f9; color: var(--text3); }

/* ---- AGENT STATUS ---- */
.agent-active   { color: #16a34a; font-weight: 600; }
.agent-inactive { color: var(--text3); }

/* ---- RULE ACTIVE ---- */
.rule-on  { color: #16a34a; }
.rule-off { color: var(--text3); }

/* ---- STATUS BAR ---- */
.status-bar {
  position: fixed; bottom: 0; left: var(--sb-width); right: 0;
  height: var(--status-h); background: #fff;
  border-top: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 20px; gap: 8px;
  font-size: 12px; color: var(--text3); z-index: 40;
  transition: left .2s;
}
.sb-sep { color: var(--border); }

/* ---- MODAL ---- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center; z-index: 200;
}

.modal-box {
  background: #fff; border-radius: 14px; width: 440px; max-width: 95vw;
  padding: 28px; box-shadow: 0 20px 60px rgba(0,0,0,.25);
}

.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.modal-head h3 { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.modal-head h3 i { color: var(--accent); }
.modal-head button { background: none; border: none; cursor: pointer; color: var(--text3); font-size: 16px; padding: 4px; border-radius: 6px; }
.modal-head button:hover { background: #f1f5f9; color: var(--text1); }

.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

.btn-cancel { padding: 0 16px; height: 38px; background: #f1f5f9; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; font-family: inherit; cursor: pointer; color: var(--text2); font-weight: 500; }
.btn-cancel:hover { background: #e2e8f0; }

.modal-msg { margin-top: 12px; font-size: 13px; text-align: center; min-height: 18px; }
.modal-msg.ok  { color: #16a34a; }
.modal-msg.err { color: var(--crit); }

/* ---- RAW LOG MODAL ---- */
.raw-log-modal-box {
  width: 860px;
  max-width: 96vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  padding: 24px;
}

.raw-log-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  padding: 10px 12px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 14px;
  font-size: 12px;
  color: var(--text2);
}

.rl-meta-item { white-space: nowrap; }
.rl-meta-sep  { color: var(--border); }

.raw-log-content {
  flex: 1;
  overflow: auto;
  background: #0f172a;
  color: #94a3b8;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 12px;
  line-height: 1.7;
  padding: 16px;
  border-radius: 8px;
  white-space: pre;
  max-height: 520px;
}

.btn-copy-raw {
  display: flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 12px;
  background: #1e293b; color: #94a3b8;
  border: 1px solid #334155; border-radius: 6px;
  font-size: 12px; font-family: inherit; cursor: pointer;
  transition: background .15s, color .15s;
}
.btn-copy-raw:hover { background: #334155; color: #e2e8f0; }

/* ---- SCROLLBAR ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ---- LIVE LOG FEED ---- */
.log-feed-card { }
.log-feed-wrap { max-height: 380px; overflow-y: auto; }
.log-feed-table { table-layout: fixed; }

.cell-time  { font-size: 11px; color: #64748b; white-space: nowrap; }
.cell-eid   { font-size: 13px; font-weight: 700; color: #1d4ed8; }
.cell-host  { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-raw   { display: flex; align-items: flex-start; gap: 6px; min-width: 0; }

.agent-id-code {
  font-size: 11px;
  color: #1d4ed8;
  background: #eff6ff;
  padding: 2px 6px;
  border-radius: 4px;
}

.log-json-snippet {
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 10px;
  line-height: 1.45;
  color: #334155;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 5px;
  padding: 5px 8px;
  margin: 0;
  white-space: pre;
  overflow: hidden;
  max-height: 120px;
  max-width: 100%;
  flex: 1;
  min-width: 0;
  width: 0;   /* force flex item to respect container width */
}

.btn-view-raw {
  flex-shrink: 0;
  margin-top: 2px;
  padding: 2px 8px;
  background: #f1f5f9;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 11px;
  font-family: inherit;
  color: var(--text2);
  cursor: pointer;
  white-space: nowrap;
  transition: background .1s;
}
.btn-view-raw:hover { background: #e2e8f0; }

.alert-dot {
  color: var(--crit);
  font-size: 16px;
  cursor: help;
}

/* ---- LOG TYPE BADGES ---- */
.log-type-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .03em;
  white-space: nowrap;
}

.lt-windows-security             { background: #ede9fe; color: #6d28d9; }
.lt-windows-application          { background: #cffafe; color: #0e7490; }
.lt-windows-system               { background: #e0e7ff; color: #4338ca; }
.lt-windows-defender-operational { background: #fef3c7; color: #b45309; }
.lt-windows-powershell-classic   { background: #dcfce7; color: #15803d; }
.lt-windows-powershell-admin     { background: #d1fae5; color: #065f46; }
.lt-windows-powershell-operational { background: #d1fae5; color: #065f46; }
.lt-windows-openssh-admin        { background: #dbeafe; color: #1d4ed8; }
.lt-windows-openssh-operational  { background: #bfdbfe; color: #1d4ed8; }
.lt-unknown                      { background: #f1f5f9; color: #64748b; }

/* ---- WINDOWS EVENT LEVEL BADGES ---- */
.lvl-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}
.lvl-critical { background: #fef2f2; color: #dc2626; }
.lvl-error    { background: #fff7ed; color: #c2410c; }
.lvl-warning  { background: #fffbeb; color: #b45309; }
.lvl-audit    { background: #f0fdf4; color: #15803d; }
.lvl-info     { background: #f8fafc; color: #64748b; }

/* ---- RESPONSIVE ---- */
@media (max-width: 1200px) {
  .kpi-row { grid-template-columns: repeat(3, 1fr); }
  .mid-row { grid-template-columns: 1fr; }
  .bot-row { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  :root { --sb-width: var(--sb-collapsed); }
  .kpi-row { grid-template-columns: 1fr 1fr; }
  .sb-logo-txt, .sb-item span, .sb-user-info { display: none; }
  .login-brand { display: none; }
  .login-form-panel { width: 100%; padding: 24px; }
}

/* =====================================================
   AI ASSISTANT PAGE — V2 (clean, two-column, no overlap)
   ===================================================== */

/* Page header */
.ai-page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.ai-page-head .page-title {
  margin: 0 0 4px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.ai-subtitle {
  margin: 0;
  color: var(--text2);
  font-size: 13px;
}
.ai-instruction {
  margin: 4px 0 0;
  color: var(--text3);
  font-size: 12px;
}
.ai-privacy-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: #ecfeff;
  color: #0e7490;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid #a5f3fc;
  white-space: nowrap;
}

/* Two-column layout */
.ai-layout {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  padding-bottom: calc(var(--status-h) + 16px);
}
.ai-col-left,
.ai-col-right {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

/* ---------- Status card (simple) ---------- */
.ai-status-card-v2 .card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.ai-status-card-v2 .card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text2);
  display: flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.btn-mini {
  background: #f1f5f9;
  border: 1px solid var(--border);
  color: var(--text2);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all .15s;
}
.btn-mini:hover {
  background: #e0f2fe;
  border-color: var(--accent);
  color: #0369a1;
}
.ai-status-simple {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 16px 6px;
}
.ai-status-text-wrap { line-height: 1.2; }
.ai-status-state {
  font-size: 18px;
  font-weight: 700;
  color: var(--text1);
}
.ai-status-sub {
  font-size: 12px;
  color: var(--text3);
  margin-top: 2px;
}
.ai-dot {
  display: inline-block;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--info);
  box-shadow: 0 0 0 4px rgba(148,163,184,.18);
  flex-shrink: 0;
}
.ai-dot-online  { background: #22c55e; box-shadow: 0 0 0 4px rgba(34,197,94,.22); }
.ai-dot-offline { background: var(--crit); box-shadow: 0 0 0 4px rgba(239,68,68,.22); }
.ai-dot-pending { background: var(--med);  box-shadow: 0 0 0 4px rgba(245,158,11,.22); }
.ai-status-hint {
  margin: 8px 16px 14px;
  padding: 8px 10px;
  background: #fef2f2;
  border-left: 3px solid var(--crit);
  border-radius: 4px;
  color: #7f1d1d;
  font-size: 12px;
  line-height: 1.5;
  word-break: break-word;
}
.ai-status-hint:empty { display: none; }

/* ---------- Context card (compact, scrollable) ---------- */
.ai-context-card-v2 .card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.ai-context-card-v2 .card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text2);
  display: flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.ai-ctx-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  padding: 0 12px;
  gap: 4px;
}
.ai-ctx-tab {
  background: none;
  border: none;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text3);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.ai-ctx-tab:hover { color: var(--text1); }
.ai-ctx-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.ai-ctx-pane {
  max-height: 360px;
  overflow-y: auto;
  padding: 8px;
}
.ai-ctx-item {
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid transparent;
  margin-bottom: 4px;
  transition: all .12s;
}
.ai-ctx-item:hover {
  background: #f8fafc;
  border-color: var(--border);
}
.ai-ctx-row1 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  min-width: 0;
}
.ai-ctx-rule {
  font-size: 13px;
  font-weight: 600;
  color: var(--text1);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}
.ai-ctx-eid {
  font-size: 12px;
  font-weight: 700;
  color: #1d4ed8;
  background: #dbeafe;
  padding: 2px 8px;
  border-radius: 4px;
}
.ai-type-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
}
.ai-type-alert {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}
.ai-type-log {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
}
.ai-ctx-src {
  font-size: 11px;
  color: var(--text2);
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 140px;
}
.ai-ctx-row2 {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 11px;
  color: var(--text2);
}
.ai-ctx-row2 i {
  color: var(--text3);
  margin-right: 3px;
}
.ai-ctx-row2 code {
  font-size: 11px;
  background: #f1f5f9;
  padding: 0 4px;
  border-radius: 3px;
}
.ai-ctx-loading,
.ai-ctx-empty {
  color: var(--text3);
  padding: 22px;
  text-align: center;
  font-size: 13px;
}

/* ---------- Actions card (right column top) ---------- */
.ai-actions-card { padding: 16px; }

.ai-model-panel {
  border: 1px solid var(--border);
  background: #f8fafc;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 14px;
}
.ai-model-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.ai-model-head .ai-label {
  margin-bottom: 0;
}
.ai-model-hint {
  color: var(--text3);
  font-size: 12px;
  text-align: right;
}
.ai-model-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.ai-model-option {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 8px;
  padding: 11px 12px;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 5px;
  color: var(--text1);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.ai-model-option:hover {
  border-color: #7dd3fc;
  box-shadow: 0 0 0 3px rgba(14,165,233,.10);
}
.ai-model-option.active {
  border-color: #0ea5e9;
  background: #f0f9ff;
  box-shadow: inset 0 0 0 1px rgba(14,165,233,.18);
}
.ai-model-option[data-profile="deep"].active {
  border-color: #a78bfa;
  background: #f5f3ff;
  box-shadow: inset 0 0 0 1px rgba(124,58,237,.16);
}
.ai-model-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
}
.ai-model-option strong {
  font-size: 13px;
}
.ai-model-desc {
  color: var(--text3);
  font-size: 12px;
  line-height: 1.35;
}
.ai-model-badge {
  border-radius: 999px;
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}
.ai-model-badge-fast {
  background: #dcfce7;
  color: #166534;
}
.ai-model-badge-deep {
  background: #ede9fe;
  color: #6d28d9;
}
.ai-model-option.missing {
  opacity: .62;
}
.ai-model-option.missing .ai-model-badge {
  background: #fee2e2;
  color: #991b1b;
}

.ai-selectors {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ai-selector { min-width: 0; }
.ai-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.ai-selector-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: stretch;
}
.ai-select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  color: var(--text1);
  cursor: pointer;
  outline: none;
  min-width: 0;
  text-overflow: ellipsis;
}
.ai-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(14,165,233,.15);
}

.event-picker {
  position: relative;
  min-width: 0;
}
.event-picker-trigger {
  width: 100%;
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font: inherit;
  cursor: pointer;
  text-align: left;
  transition: border-color .15s, box-shadow .15s;
}
.event-picker-trigger:hover,
.event-picker.open .event-picker-trigger {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(14,165,233,.12);
}
.event-picker-selected {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.event-picker-panel {
  display: none;
  position: absolute;
  z-index: 40;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 18px 48px rgba(15,23,42,.18);
  overflow: hidden;
}
.event-picker.open .event-picker-panel { display: block; }
.event-picker-tools {
  padding: 10px;
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
}
.event-picker-search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #fff;
}
.event-picker-search i { color: var(--text3); }
.event-picker-search input {
  width: 100%;
  border: 0;
  outline: 0;
  font: inherit;
  color: var(--text1);
  background: transparent;
}
.event-picker-filters {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}
.event-filter {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text2);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.event-filter.active {
  background: #e0f2fe;
  border-color: #7dd3fc;
  color: #0369a1;
}
.event-picker-list {
  max-height: 360px;
  overflow-y: auto;
  padding: 6px;
}
.event-picker-item {
  width: 100%;
  display: grid;
  gap: 5px;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: #fff;
  color: var(--text1);
  text-align: left;
  cursor: pointer;
  font: inherit;
}
.event-picker-item:hover {
  background: #f8fafc;
  border-color: var(--border);
}
.event-picker-item.selected {
  background: #eff6ff;
  border-color: #93c5fd;
}
.event-picker-main {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}
.event-picker-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}
.event-picker-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-left: 1px;
  color: var(--text3);
  font-size: 11px;
}
.event-picker-empty {
  padding: 24px;
  text-align: center;
  color: var(--text3);
  font-size: 13px;
}
.btn-analyze {
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 13px;
}
.btn-analyze:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.ai-divider {
  position: relative;
  text-align: center;
  margin: 18px 0 12px;
}
.ai-divider::before {
  content: '';
  position: absolute;
  inset: 50% 0 auto 0;
  height: 1px;
  background: var(--border);
}
.ai-divider span {
  position: relative;
  background: var(--card-bg);
  padding: 0 12px;
  font-size: 11px;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

.ai-prompt-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.ai-chip {
  background: #f1f5f9;
  border: 1px solid var(--border);
  color: var(--text1);
  font-size: 12px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ai-chip:hover {
  background: #e0f2fe;
  border-color: var(--accent);
  color: #0369a1;
}

.ai-textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  resize: vertical;
  min-height: 80px;
  outline: none;
  transition: border-color .15s;
  background: #fff;
  color: var(--text1);
  word-break: break-word;
}
.ai-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(14,165,233,.15);
}

.ai-ask-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.ai-ask-actions .btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.ai-note {
  font-size: 12px;
  color: var(--text3);
}

/* ---------- Response card ---------- */
.ai-response-card .card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.ai-response-card .card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text2);
  display: flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.ai-response-meta-inline {
  font-size: 11px;
  color: var(--text3);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.ai-response {
  padding: 16px 18px;
  background: #fff;
  min-height: 220px;
  max-height: 520px;
  overflow-y: auto;
  font-size: 14px;
  line-height: 1.65;
  color: var(--text1);
  word-break: break-word;
  overflow-wrap: anywhere;
}
.ai-response-empty {
  color: var(--text3);
  font-style: italic;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 28px 8px;
}
.ai-response-empty i { font-size: 22px; color: #cbd5e1; }
.ai-generating {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;
  border: 1px solid #bae6fd;
  background: #f0f9ff;
  border-radius: 8px;
  color: #075985;
  font-size: 12px;
}
.ai-generating strong,
.ai-generating span {
  display: block;
}
.ai-generating span {
  color: #64748b;
  margin-top: 1px;
}
.ai-generate-dot {
  width: 10px;
  height: 10px;
  flex: 0 0 10px;
  border-radius: 50%;
  background: #0ea5e9;
  box-shadow: 0 0 0 0 rgba(14, 165, 233, .45);
  animation: aiPulse 1.35s infinite;
}
.ai-streaming-text:empty {
  display: none;
}
@keyframes aiPulse {
  0% { box-shadow: 0 0 0 0 rgba(14, 165, 233, .45); }
  70% { box-shadow: 0 0 0 8px rgba(14, 165, 233, 0); }
  100% { box-shadow: 0 0 0 0 rgba(14, 165, 233, 0); }
}
.ai-response-loading {
  color: var(--text2);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 0;
}
.ai-response-err {
  color: #991b1b;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 6px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.ai-response-hint {
  color: #92400e;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 6px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.ai-response-text {
  white-space: normal;
}
.ai-section-h {
  font-weight: 700;
  color: var(--accent);
  margin-top: 14px;
  margin-bottom: 4px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.ai-section-h:first-child { margin-top: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .ai-layout { grid-template-columns: 1fr; }
  .ai-ctx-pane { max-height: 280px; }
}
@media (max-width: 640px) {
  .ai-model-options { grid-template-columns: 1fr; }
  .ai-model-head { align-items: flex-start; flex-direction: column; }
  .ai-model-hint { text-align: left; }
  .ai-selector-row { grid-template-columns: 1fr; }
  .btn-analyze { justify-content: center; }
}

/* =====================================================
   PLAYBOOKS / RUNBOOKS
   ===================================================== */

.playbook-page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.runbook-page-actions, .runbook-detail-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.pb-subtitle { color: var(--text2); font-size: 13px; margin-top: 5px; }
.playbook-tools { display: grid; grid-template-columns: minmax(260px, 1fr) 180px 220px; gap: 10px; align-items: center; padding: 12px; }
.playbook-coverage { display: grid; grid-template-columns: auto minmax(220px, 1fr) auto; align-items: center; gap: 14px; padding: 12px 14px; }
.pb-coverage-item { display: flex; align-items: baseline; gap: 10px; white-space: nowrap; }
.pb-coverage-label { color: var(--text3); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.pb-coverage-item strong { font-size: 20px; color: var(--text1); }
.pb-coverage-bar { height: 9px; background: #e2e8f0; border-radius: 999px; overflow: hidden; }
.pb-coverage-bar span { display: block; height: 100%; background: linear-gradient(90deg, #0ea5e9, #22c55e); }
.pb-coverage-meta { display: flex; align-items: center; gap: 10px; color: var(--text3); font-size: 12px; font-weight: 700; white-space: nowrap; }
.pb-coverage-ok { color: #16a34a; }
.pb-coverage-warn { color: #f97316; }
.pb-search { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.pb-search i { color: var(--text3); }
.pb-search input { width: 100%; border: 0; outline: 0; font: inherit; color: var(--text1); }
.pb-filter { height: 38px; border: 1px solid var(--border); border-radius: 8px; background: #fff; color: var(--text2); font: inherit; padding: 0 10px; }
.playbook-layout { display: grid; grid-template-columns: 330px minmax(0, 1fr) 280px; gap: 14px; align-items: start; }
.playbook-library-layout { grid-template-columns: 330px minmax(0, 1fr); }
.runbook-layout { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 14px; align-items: start; }
.playbook-list-card, .playbook-runs-card { position: sticky; top: calc(var(--header-h) + 14px); }
.playbook-list, .playbook-runs { max-height: calc(100vh - 240px); overflow-y: auto; padding-right: 2px; }
.playbook-item, .pb-run-item { width: 100%; border: 1px solid transparent; background: #fff; color: var(--text1); text-align: left; cursor: pointer; border-radius: 8px; padding: 10px; margin-bottom: 8px; display: grid; gap: 7px; transition: background .12s, border-color .12s, box-shadow .12s; font: inherit; }
.playbook-item:hover, .pb-run-item:hover { background: #f8fafc; border-color: var(--border); }
.playbook-item.active, .pb-run-item.active { background: #eff6ff; border-color: #93c5fd; box-shadow: inset 3px 0 0 #2563eb; }
.pb-item-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pb-category { color: var(--text3); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.pb-item-name, .pb-run-title { font-size: 13px; font-weight: 700; color: var(--text1); line-height: 1.3; }
.pb-item-summary { color: var(--text2); font-size: 12px; line-height: 1.45; }
.pb-event-tags, .pb-tag-row { display: flex; flex-wrap: wrap; gap: 6px; }
.pb-event-tags span, .pb-tag { display: inline-flex; align-items: center; min-height: 22px; padding: 2px 8px; border-radius: 999px; background: #f1f5f9; color: #475569; font-size: 11px; font-weight: 700; }
.pb-tag-mitre { background: #ecfeff; color: #0e7490; }
.playbook-detail-card { min-height: 560px; }
.pb-detail-empty, .pb-empty { min-height: 120px; display: flex; align-items: center; justify-content: center; gap: 10px; text-align: center; color: var(--text3); font-size: 13px; }
.pb-detail-empty i { font-size: 24px; color: #cbd5e1; }
.pb-detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--border); padding-bottom: 16px; margin-bottom: 14px; }
.pb-detail-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.pb-detail-meta > span:last-child { color: var(--text3); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.pb-detail-head h3 { font-size: 20px; line-height: 1.25; margin-bottom: 6px; }
.pb-detail-head p { color: var(--text2); line-height: 1.55; max-width: 760px; }
.pb-detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; margin-top: 14px; }
.pb-panel { border: 1px solid var(--border); border-radius: 8px; padding: 14px; background: #fff; margin-top: 12px; }
.pb-panel h4, .pb-steps h4 { display: flex; align-items: center; gap: 7px; color: var(--text2); font-size: 13px; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 10px; }
.pb-panel h4:not(:first-child) { margin-top: 14px; }
.pb-panel h4 i, .pb-steps h4 i { color: var(--accent); }
.pb-panel p { color: var(--text2); font-size: 13px; line-height: 1.55; }
.pb-check-list, .pb-rule-list { list-style: none; display: grid; gap: 8px; }
.pb-check-list li, .pb-rule-list li { color: var(--text2); font-size: 13px; line-height: 1.45; display: flex; gap: 8px; }
.pb-check-list i { color: #16a34a; margin-top: 2px; }
.pb-steps { margin-top: 16px; }
.pb-step { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 10px; padding: 12px 0; border-top: 1px solid #f1f5f9; }
.pb-step-focus { background: #f0f9ff; border-radius: 8px; box-shadow: 0 0 0 2px #7dd3fc inset; transition: box-shadow .2s, background .2s; }
.pb-step:first-of-type { border-top: 0; }
.pb-step-marker { display: flex; justify-content: center; padding-top: 2px; }
.pb-step-num { width: 26px; height: 26px; border-radius: 50%; background: #eff6ff; color: #1d4ed8; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; }
.pb-step-marker input { width: 18px; height: 18px; accent-color: #16a34a; cursor: pointer; }
.pb-step.done .pb-step-body { opacity: .72; }
.pb-step-top { display: flex; align-items: center; gap: 7px; margin-bottom: 5px; }
.pb-phase { color: #0369a1; background: #e0f2fe; border: 1px solid #bae6fd; border-radius: 5px; padding: 2px 7px; font-size: 10px; font-weight: 800; text-transform: uppercase; }
.pb-step-type { color: var(--text3); font-size: 11px; text-transform: uppercase; font-weight: 700; }
.pb-step h5 { font-size: 14px; margin-bottom: 4px; }
.pb-step p { color: var(--text2); font-size: 13px; line-height: 1.55; }
.pb-command { position: relative; margin-top: 10px; background: #0f172a; border-radius: 8px; border: 1px solid #1e293b; }
.pb-command pre { color: #cbd5e1; font: 12px/1.6 'Consolas', 'Courier New', monospace; white-space: pre-wrap; overflow-x: auto; padding: 12px 42px 12px 12px; }
.btn-copy-cmd { position: absolute; top: 8px; right: 8px; width: 26px; height: 26px; border: 1px solid #334155; background: #1e293b; color: #cbd5e1; border-radius: 6px; cursor: pointer; }
.btn-copy-cmd:hover { background: #334155; }
.pb-alert-match { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: #fffbeb; color: #92400e; border: 1px solid #fde68a; border-radius: 8px; padding: 10px 12px; margin-bottom: 14px; font-size: 13px; }
.pb-alert-match .btn-primary { margin-left: auto; }
.runbook-facts { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.runbook-facts span { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; padding: 4px 9px; border: 1px solid var(--border); border-radius: 7px; background: #f8fafc; color: var(--text2); font-size: 12px; font-weight: 700; }
.runbook-facts i { color: var(--accent); }
.pb-run-progress { display: grid; grid-template-columns: minmax(160px, auto) minmax(160px, 1fr) auto; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: #f8fafc; margin-bottom: 12px; color: var(--text2); font-size: 13px; }
.pb-run-progress div:first-child { display: flex; gap: 8px; }
.pb-progress-bar, .pb-run-bar { display: block; height: 7px; background: #e2e8f0; border-radius: 999px; overflow: hidden; }
.pb-progress-bar span, .pb-run-bar span { display: block; height: 100%; background: linear-gradient(90deg, #0ea5e9, #14b8a6); }
.pb-run-meta, .pb-run-status { color: var(--text3); font-size: 11px; }
.run-status-pill { display: inline-flex; align-items: center; min-height: 22px; padding: 2px 8px; border-radius: 999px; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; border: 1px solid transparent; }
.run-status-in-progress { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.run-status-completed { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.run-status-cancelled { background: #f8fafc; color: #64748b; border-color: #cbd5e1; }
.btn-playbook-mini { display: inline-flex; align-items: center; gap: 5px; height: 28px; border: 1px solid #bae6fd; background: #e0f2fe; color: #0369a1; border-radius: 6px; padding: 0 9px; font-size: 12px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.btn-playbook-mini:hover { background: #bae6fd; }
.btn-playbook-mini:disabled, .runbook-detail-actions button:disabled { opacity: .55; cursor: not-allowed; }
.btn-run-cancel { border-color: #fecaca; background: #fef2f2; color: #b91c1c; }
.btn-run-cancel:hover { background: #fee2e2; }
.run-report-modal-box { width: 920px; max-width: 95vw; max-height: 86vh; overflow: auto; }
.run-report-content { display: grid; gap: 14px; }
.run-report-summary { display: grid; grid-template-columns: repeat(4, minmax(120px, 1fr)); gap: 10px; }
.run-report-summary div { border: 1px solid var(--border); border-radius: 8px; padding: 10px; background: #f8fafc; display: grid; gap: 4px; }
.run-report-summary span { color: var(--text3); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.run-report-summary strong { color: var(--text1); font-size: 16px; text-transform: capitalize; }
.run-report-meta { border: 1px solid var(--border); border-radius: 8px; padding: 12px; }
.run-report-meta h4 { margin-bottom: 5px; font-size: 15px; }
.run-report-meta p { color: var(--text2); font-size: 13px; line-height: 1.5; margin-bottom: 8px; }
.run-report-meta span { display: inline-flex; margin-right: 12px; color: var(--text3); font-size: 12px; font-weight: 700; }
.run-report-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.run-report-table th, .run-report-table td { border-bottom: 1px solid #e2e8f0; padding: 9px 8px; text-align: left; vertical-align: top; }
.run-report-table th { color: var(--text3); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.report-ok { color: #16a34a; }
.report-pending { color: #94a3b8; }

@media (max-width: 1300px) {
  .playbook-layout { grid-template-columns: 300px minmax(0, 1fr); }
  .playbook-runs-card { grid-column: 1 / -1; position: static; }
  .runbook-layout .playbook-runs-card { grid-column: auto; position: sticky; }
  .playbook-runs { max-height: 240px; }
}
@media (max-width: 900px) {
  .playbook-tools, .playbook-coverage, .playbook-layout, .runbook-layout, .pb-detail-grid, .pb-run-progress { grid-template-columns: 1fr; }
  .playbook-list-card { position: static; }
  .runbook-layout .playbook-runs-card { position: static; }
  .playbook-list { max-height: 360px; }
  .pb-alert-match .btn-primary { margin-left: 0; }
  .runbook-page-actions, .runbook-detail-actions { justify-content: flex-start; }
  .run-report-summary { grid-template-columns: 1fr 1fr; }
}
