:root {
  --navy: #13263b; --navy-2: #1b3450; --accent: #1f4e79; --accent-2: #2a6aa6;
  --bg: #f3f5f8; --card: #ffffff; --line: #dde3ea; --text: #1d2733; --muted: #607080;
  --ok: #2e7d32; --err: #c62828; --warn: #ef6c00;
  --critical: #7b1fa2; --high: #c62828; --medium: #ef6c00; --low: #2e7d32; --info: #546e7a;
  --radius: 8px; --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  font-family: Inter, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif; font-size: 14px; color: var(--text);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
a { color: var(--accent-2); text-decoration: none; } a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0; } h2 { font-size: 18px; margin: 0 0 12px; } h3 { font-size: 15px; margin: 0 0 10px; } h4 { font-size: 13px; margin: 0 0 8px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.hidden { display: none !important; }
.muted { color: var(--muted); } .small { font-size: 12px; } .mono, code, pre { font-family: "SF Mono", Menlo, Consolas, monospace; } .nowrap { white-space: nowrap; }
.ok-text { color: var(--ok); font-weight: 600; } .err-text { color: var(--err); }
.boot { padding: 40px; color: var(--muted); }

/* ---------- login ---------- */
.login-page { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(160deg, var(--navy) 0%, var(--navy-2) 60%, #234a72 100%); padding: 16px; }
.login-card { width: 100%; max-width: 380px; background: var(--card); border-radius: 12px; padding: 28px; box-shadow: 0 20px 50px rgba(0, 0, 0, .3); display: flex; flex-direction: column; gap: 12px; }
.login-brand { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; }
.login-title { font-size: 18px; font-weight: 700; }
.form-error { color: var(--err); min-height: 1em; font-size: 13px; }
.fine { font-size: 11px; color: var(--muted); margin: 4px 0 0; text-align: center; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; }
.sidebar { background: var(--navy); color: #d6e0ea; display: flex; flex-direction: column; padding: 16px 12px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: #fff; padding: 4px 8px 18px; font-size: 15px; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidebar nav a { color: #c3d0dd; padding: 8px 10px; border-radius: 6px; font-weight: 500; }
.sidebar nav a:hover { background: rgba(255, 255, 255, .06); text-decoration: none; color: #fff; }
.sidebar nav a.active { background: var(--accent); color: #fff; }
.sidebar-foot { border-top: 1px solid rgba(255, 255, 255, .1); padding: 12px 8px 0; display: flex; flex-direction: column; gap: 4px; }
.sidebar-foot .who { color: #fff; font-weight: 600; } .sidebar-foot .muted { color: #9fb0c1; }
.sidebar-foot .btn { margin-top: 6px; color: #d6e0ea; border-color: rgba(255, 255, 255, .2); }
.main { min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 12px 24px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
#crumbs { color: var(--muted); display: flex; gap: 8px; align-items: center; } #crumbs .sep { color: #b5c0cc; }
.content { padding: 24px; max-width: 1400px; }
.page-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 12px; }
.banner { padding: 10px 24px; font-weight: 600; }
.banner.danger { background: var(--err); color: #fff; }
.content .banner { border-radius: var(--radius); margin: 0 0 12px; padding: 10px 14px; }
.banner.info { background: #e8f0f8; color: #234a72; font-weight: 500; }

/* ---------- cards, layout ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px; box-shadow: var(--shadow); }
.warn-card { border-left: 4px solid var(--warn); } .ok-card { border-left: 4px solid var(--ok); } .excl-card { border-left: 4px solid var(--err); }
.two-col { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.row2 { display: grid; grid-template-columns: 2fr 1fr; gap: 12px; }
.row3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 1000px) { .two-col, .row3, .row2 { grid-template-columns: 1fr; } .shell { grid-template-columns: 1fr; } .sidebar { position: static; height: auto; } }

/* ---------- forms ---------- */
.form { display: flex; flex-direction: column; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field .lbl { font-size: 12px; font-weight: 600; color: #3b4a59; }
.field .hint { font-size: 11px; color: var(--muted); }
input, select, textarea { font: inherit; padding: 7px 9px; border: 1px solid #c8d1db; border-radius: 6px; background: #fff; color: var(--text); width: 100%; min-width: 0; }
textarea { resize: vertical; } input:focus, select:focus, textarea:focus { outline: 2px solid rgba(42, 106, 166, .35); border-color: var(--accent-2); }
input[type=checkbox] { width: auto; } input[type=color] { height: 36px; padding: 2px; }
input:disabled, select:disabled { background: #f1f4f7; color: #6b7785; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px 12px; margin: 0; display: flex; flex-direction: column; gap: 10px; }
legend { font-weight: 600; font-size: 12px; color: var(--accent); padding: 0 6px; text-transform: uppercase; letter-spacing: .04em; }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; } .inline-form input { flex: 1; min-width: 140px; } .inline-form select { width: auto; }
.check { display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; font-size: 13px; }
.check-field > span:last-child { display: flex; align-items: center; gap: 6px; padding-top: 8px; }
.actions { display: flex; justify-content: flex-end; gap: 8px; align-items: center; }
.actions.sticky { position: sticky; bottom: -16px; background: #fff; padding: 10px 0; border-top: 1px solid var(--line); }
.toolbar { display: flex; gap: 8px; margin-bottom: 12px; align-items: center; flex-wrap: wrap; } .toolbar select { width: auto; } .toolbar input { width: 240px; } .spacer { flex: 1; }
.alert { padding: 10px 12px; border-radius: 6px; margin: 6px 0; font-size: 13px; } .alert ul { margin: 6px 0 0; padding-left: 18px; }
.alert.error { background: #fdecea; color: #8e1c1c; border: 1px solid #f5c2bd; } .alert.ok { background: #e8f5e9; color: #1b5e20; border: 1px solid #b9dfbb; }

/* ---------- buttons ---------- */
.btn { font: inherit; font-weight: 600; padding: 7px 14px; border-radius: 6px; border: 1px solid #c8d1db; background: #fff; color: var(--text); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; text-decoration: none !important; white-space: nowrap; }
.btn:hover { background: #f4f7fa; } .btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; } .btn.primary:hover { background: var(--accent-2); }
.btn.danger { background: var(--err); border-color: var(--err); color: #fff; } .btn.danger:hover { background: #a91f1f; }
.btn.warn { background: var(--warn); border-color: var(--warn); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--accent-2); } .btn.ghost:hover { background: #eef3f8; }
.btn.small { padding: 4px 9px; font-size: 12px; } .btn.block { width: 100%; justify-content: center; padding: 10px; }
.icon-btn { background: none; border: 0; font-size: 24px; line-height: 1; cursor: pointer; color: var(--muted); }

/* ---------- tables ---------- */
table.grid { width: 100%; border-collapse: collapse; }
.grid th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); background: #fafbfc; }
.grid td { padding: 9px 10px; border-bottom: 1px solid #edf1f5; vertical-align: top; }
.grid tr.clickable { cursor: pointer; } .grid tr.clickable:hover td { background: #f6f9fc; }
.grid tr.dim td { opacity: .5; } .grid tr.inactive td { opacity: .5; } .grid tr.flag td { background: #fff8f7; }
.grid td.empty { text-align: center; color: var(--muted); padding: 24px; }
.trunc { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.audit .details { max-width: 520px; word-break: break-word; }
ul.reasons { margin: 4px 0 0; padding-left: 16px; font-size: 12px; color: #8e1c1c; }
ul.plain { list-style: none; padding: 0; margin: 0 0 8px; } ul.plain li { padding: 4px 0; border-bottom: 1px dashed #eef1f4; }

/* ---------- badges & pills ---------- */
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 700; color: #fff; letter-spacing: .02em; white-space: nowrap; }
.sev-critical { background: var(--critical); } .sev-high { background: var(--high); } .sev-medium { background: var(--medium); } .sev-low { background: var(--low); } .sev-info { background: var(--info); }
.badge.ok { background: var(--ok); } .badge.no { background: var(--err); }
.st-open { background: #1565c0; } .st-confirmed { background: #6a1b9a; } .st-fixed { background: var(--ok); } .st-false_positive { background: #90a4ae; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; background: #e7ecf2; color: #3b4a59; margin-left: 4px; text-transform: lowercase; }
.eng-active { background: #e3f4e5; color: #1b5e20; } .eng-draft { background: #eceff1; } .eng-paused { background: #fff3e0; color: #8a4b00; } .eng-completed { background: #e3ecf7; color: #234a72; } .eng-killed { background: var(--err); color: #fff; }
.scan-completed { background: #e3f4e5; color: #1b5e20; } .scan-running, .scan-queued { background: #e3ecf7; color: #234a72; } .scan-refused, .scan-failed, .scan-killed { background: #fdecea; color: #8e1c1c; } .scan-cancelled { background: #eceff1; }
.rep-published { background: #e3f4e5; color: #1b5e20; } .rep-draft { background: #fff3e0; color: #8a4b00; }

/* ---------- engagement page ---------- */
.eng-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 12px; }
.eng-head h1 { margin-bottom: 4px; } .eng-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 9px 14px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.active { color: var(--accent); border-bottom-color: var(--accent); } .tabs a:hover { text-decoration: none; color: var(--text); }
.sev-summary { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-bottom: 16px; }
.sev-tile { background: #fff; border: 1px solid var(--line); border-top: 4px solid; border-radius: var(--radius); padding: 10px; cursor: pointer; display: flex; flex-direction: column; align-items: center; font: inherit; box-shadow: var(--shadow); }
.sev-tile .n { font-size: 24px; font-weight: 700; } .sev-tile .l { font-size: 11px; text-transform: uppercase; color: var(--muted); letter-spacing: .05em; }
.sev-tile.on { outline: 2px solid var(--accent-2); }
.t-critical { border-top-color: var(--critical); } .t-critical .n { color: var(--critical); } .t-high { border-top-color: var(--high); } .t-high .n { color: var(--high); }
.t-medium { border-top-color: var(--medium); } .t-medium .n { color: var(--medium); } .t-low { border-top-color: var(--low); } .t-low .n { color: var(--low); } .t-info { border-top-color: var(--info); } .t-info .n { color: var(--info); }

/* ---------- modal ---------- */
.overlay { position: fixed; inset: 0; background: rgba(15, 25, 40, .5); display: flex; justify-content: center; align-items: flex-start; padding: 40px 16px; z-index: 50; overflow-y: auto; }
.modal { background: #fff; border-radius: 10px; width: 100%; max-width: 560px; box-shadow: 0 25px 60px rgba(0, 0, 0, .3); }
.modal.wide { max-width: 1180px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); } .modal-head h2 { margin: 0; }
.modal-body { padding: 16px 18px; }
.finding-editor { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; }
@media (max-width: 1000px) { .finding-editor { grid-template-columns: 1fr; } }
.fe-side { display: flex; flex-direction: column; gap: 12px; }
.side-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; background: #fafbfc; display: flex; flex-direction: column; gap: 8px; }
.side-card dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; font-size: 12px; } .side-card dt { color: var(--muted); } .side-card dd { margin: 0; word-break: break-word; }
ul.notes { list-style: none; padding: 0; margin: 0; max-height: 220px; overflow-y: auto; } ul.notes li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.pre { white-space: pre-wrap; font-size: 13px; }
.cvss-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.cvss-out { display: flex; align-items: center; gap: 8px; min-height: 34px; font-size: 18px; }
pre.code { background: #0f1b2a; color: #d6e6f5; padding: 10px; border-radius: 6px; white-space: pre-wrap; word-break: break-all; font-size: 12px; }
.report-frame { width: 100%; height: 75vh; border: 1px solid var(--line); border-radius: 6px; background: #fff; } .report-frame.tall { height: 85vh; margin-top: 8px; }

/* ---------- toast ---------- */
.toast { position: fixed; right: 20px; bottom: 20px; background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 8px; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); z-index: 100; max-width: 420px; }
.toast.error { background: var(--err); }

/* ---------- live scan console ---------- */
.btn.live { border-color: var(--err); color: var(--err); }
.console-wrap { display: flex; flex-direction: column; gap: 8px; }
.live-text { color: var(--err); font-weight: 600; }
pre.console { background: #0d1b2a; color: #d6e2f0; font-size: 12px; line-height: 1.5; padding: 14px; border-radius: 8px;
  height: 60vh; max-height: 560px; overflow: auto; white-space: pre-wrap; word-break: break-word; margin: 0; }

/* ---------- network map ---------- */
.map-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.map-controls .field { margin: 0; min-width: 180px; }
.map-info { font-size: 12px; margin: 4px 0 8px; }
.map-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 10px; font-size: 12px; color: var(--muted); }
.map-legend .lg { display: inline-flex; align-items: center; gap: 6px; }
.map-legend .dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.dot.sev-critical { background: var(--critical); } .dot.sev-high { background: var(--high); } .dot.sev-medium { background: var(--medium); } .dot.sev-low { background: var(--low); } .dot.sev-info { background: var(--info); }
.map-canvas { background: radial-gradient(circle at 50% 45%, #1b3450 0%, #13263b 70%); border-radius: 10px; overflow: hidden; }
.map-svg { width: 100%; height: auto; display: block; }
.map-edge { stroke: rgba(170, 190, 215, .35); stroke-width: 1.5; }
.map-node { cursor: pointer; outline: none; }
.map-node .node-dot { stroke: #0d1b2a; stroke-width: 2; transition: r .1s; }
.map-node.kind-engagement .node-dot { fill: var(--accent-2); stroke: #fff; }
.node-dot.sev-critical { fill: var(--critical); } .node-dot.sev-high { fill: var(--high); } .node-dot.sev-medium { fill: var(--medium); } .node-dot.sev-low { fill: var(--low); } .node-dot.sev-info { fill: #78909c; }
.map-node:hover .node-dot, .map-node:focus .node-dot { stroke: #fff; stroke-width: 3; }
.map-node.sel .node-dot { stroke: #ffd54f; stroke-width: 3.5; }
.node-count { fill: #fff; font-size: 12px; font-weight: 700; pointer-events: none; }
.node-label { fill: #cdd9e6; font-size: 11px; pointer-events: none; }
.map-detail { margin-top: 12px; padding: 12px 14px; background: #fafbfc; border: 1px solid var(--line); border-radius: 8px; min-height: 60px; }
.map-detail .sev-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 8px 0; }
.map-detail .sev-count { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; }

/* ---------- AI co-pilot ---------- */
.copilot-card { display: flex; flex-direction: column; }
.copilot-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.copilot-actions { display: flex; gap: 8px; align-items: center; }
.copilot-feed { margin: 12px 0; max-height: 52vh; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding: 4px; }
.copilot-empty { padding: 20px; text-align: center; }
.copilot-msg { display: flex; flex-direction: column; gap: 3px; max-width: 86%; }
.copilot-msg .who { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.copilot-msg .body { padding: 10px 13px; border-radius: 10px; line-height: 1.5; }
.copilot-msg .body p { margin: 0 0 8px; } .copilot-msg .body p:last-child { margin: 0; }
.copilot-msg .body ul { margin: 4px 0; padding-left: 18px; }
.copilot-msg.user { align-self: flex-end; align-items: flex-end; }
.copilot-msg.user .body { background: var(--accent); color: #fff; }
.copilot-msg.assistant .body { background: #eef3f8; color: var(--text); border: 1px solid var(--line); }
.copilot-thinking { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 8px; margin: 2px 0 8px; }
.spinner { width: 14px; height: 14px; border: 2px solid #c8d1db; border-top-color: var(--accent-2); border-radius: 50%; display: inline-block; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.copilot-input { display: flex; gap: 8px; align-items: flex-end; }
.copilot-input textarea { resize: vertical; }

/* ---------- Pen-test workflow ---------- */
.atk-chain { border-left: 4px solid var(--accent); }
.atk-chain-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.atk-chain-head h3 { margin: 0; }
.atk-chain-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.badge.chain-planned, .badge.step-planned { background: #90a4ae; }
.badge.chain-in_progress, .badge.step-in_progress { background: #1565c0; }
.badge.chain-achieved, .badge.step-succeeded { background: var(--err); }
.badge.chain-blocked, .badge.step-blocked { background: var(--warn); }
.badge.chain-abandoned, .badge.step-failed { background: #607d8b; }
.pill.tactic { background: var(--navy); color: #fff; text-transform: none; }
.atk-steps { list-style: none; margin: 12px 0 0; padding: 0; counter-reset: atk; }
.atk-step { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.atk-step:first-child { border-top: none; }
.atk-step-main { flex: 1; min-width: 0; }
.atk-step-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.atk-step-head::before { counter-increment: atk; content: counter(atk); background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; width: 20px; height: 20px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.atk-desc { margin: 6px 0; white-space: pre-wrap; }
.atk-evidence { margin: 6px 0; }
.atk-evidence summary { cursor: pointer; color: var(--accent-2); font-size: 13px; }
.atk-evidence pre.console { margin-top: 6px; }
.atk-step-actions { display: flex; gap: 4px; align-items: flex-start; flex-wrap: wrap; justify-content: flex-end; }

/* ---------- Simulated attack demo ---------- */
.demo-banner { display: block; }
.demo-controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.demo-grid { display: grid; grid-template-columns: 1fr 320px; gap: 16px; align-items: start; }
@media (max-width: 860px) { .demo-grid { grid-template-columns: 1fr; } }
.demo-track { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.demo-phase { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); padding: 3px 10px; border: 1px solid var(--line); border-radius: 14px; }
.demo-phase .dot { width: 8px; height: 8px; border-radius: 50%; background: #c8d1db; flex: none; }
.demo-phase.active { color: var(--accent); border-color: var(--accent-2); font-weight: 600; }
.demo-phase.active .dot { background: var(--accent-2); animation: demopulse 1s ease-in-out infinite; }
.demo-phase.done { color: var(--ok); border-color: #bfe0c1; }
.demo-phase.done .dot { background: var(--ok); }
@keyframes demopulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
.demo-console { min-height: 46vh; max-height: 60vh; }
.demo-line { display: block; white-space: pre-wrap; }
.demo-cmd { color: #8ad4ff; }
.demo-out { color: #cfe3d6; }
.demo-phasehdr { color: #ffd479; font-weight: 700; }
.demo-narrator { color: #d8b4ff; font-style: italic; }
.demo-muted { color: #8a98a6; }
.demo-done { color: #7ee081; font-weight: 700; }
.demo-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.demo-list li { padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.demo-find-head { display: flex; justify-content: space-between; align-items: center; }
.demo-tally { display: flex; gap: 10px; }
.demo-tally-item { font-size: 12px; font-weight: 600; }

/* ---------- Report: tools & techniques editor ---------- */
.tech-editor { border: 1px solid var(--line); border-radius: 6px; padding: 8px; }
.tech-row { display: grid; grid-template-columns: 1.1fr 1fr 1.4fr 1.2fr 24px; gap: 6px; align-items: center; margin-bottom: 6px; }
.tech-row input { width: 100%; }
.tech-head { margin-bottom: 4px; font-weight: 600; }
.tech-head span { padding: 0 2px; }
@media (max-width: 760px) { .tech-row { grid-template-columns: 1fr 1fr; } .tech-head { display: none; } }
