:root {
  --bg: #f3f6fa;
  --surface: #ffffff;
  --surface-2: #eef3f8;
  --surface-3: #e5edf6;
  --ink: #172033;
  --muted: #68758a;
  --line: #d8e0eb;
  --navy: #102f53;
  --navy-2: #1a446f;
  --blue: #1769aa;
  --blue-soft: #e9f3fc;
  --purple: #7048a8;
  --purple-soft: #f3ecfb;
  --red: #c73532;
  --red-soft: #fff0ef;
  --amber: #a86300;
  --amber-soft: #fff4dc;
  --green: #16784b;
  --green-soft: #e8f7ef;
  --shadow: 0 12px 35px rgba(16, 47, 83, .10);
  --radius: 14px;
  --sidebar: 288px;
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink); font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; line-height: 1.45; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.eyebrow { margin: 0 0 5px; color: var(--blue); font-size: 11px; font-weight: 850; letter-spacing: .11em; text-transform: uppercase; }
h1, h2, h3, p { overflow-wrap: anywhere; }
h1 { margin: 0; color: var(--navy); font-size: clamp(25px, 3vw, 38px); line-height: 1.12; }
h2 { margin: 0; color: var(--navy); font-size: 18px; }
h3 { color: var(--navy); }
code { border-radius: 5px; background: var(--surface-2); padding: 2px 5px; }

.btn { min-height: 38px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--navy); padding: 8px 12px; font-weight: 760; box-shadow: 0 2px 8px rgba(16,47,83,.04); }
.btn:hover { border-color: var(--blue); }
.btn.primary { border-color: var(--navy); background: var(--navy); color: #fff; }
.btn.primary:hover { background: var(--navy-2); }
.btn.subtle { background: var(--surface-2); box-shadow: none; }
.btn.danger { color: var(--red); }
.btn.link { border: 0; background: transparent; box-shadow: none; color: var(--blue); }
.btn.small { min-height: 32px; padding: 5px 9px; font-size: 12px; }
.btn.wide { width: 100%; }
.btn.ai-btn { border-color: #8a64ba; background: linear-gradient(135deg,#f5effc,#eaf4ff); color: #58358a; }
.btn.ai-btn:hover { border-color: #7048a8; box-shadow: 0 5px 16px rgba(112,72,168,.16); }
.icon-btn { width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 20px; }
.icon-btn:hover { background: var(--surface-2); color: var(--navy); }
.mini-btn { border: 0; background: transparent; color: var(--blue); font-size: 11px; font-weight: 850; }

.app-shell { display: grid; grid-template-columns: var(--sidebar) minmax(0,1fr); min-height: 100vh; transition: grid-template-columns .22s ease; }
.sidebar { position: sticky; top: 0; width: var(--sidebar); height: 100vh; display: flex; flex-direction: column; background: var(--navy); color: #fff; box-shadow: 8px 0 24px rgba(16,47,83,.12); z-index: 30; transition: opacity .18s ease,transform .22s ease; }
.app-shell.sidebar-collapsed { grid-template-columns: 0 minmax(0,1fr); }
.app-shell.sidebar-collapsed .sidebar { opacity: 0; pointer-events: none; transform: translateX(-100%); }
.brand-row { min-height: 74px; display: flex; align-items: center; gap: 11px; padding: 15px 18px; border-bottom: 1px solid rgba(255,255,255,.11); }
.brand-row strong, .brand-row span { display: block; line-height: 1.05; }
.brand-row strong { font-size: 17px; }
.brand-row span { color: rgba(255,255,255,.65); font-size: 11px; letter-spacing: .09em; text-transform: uppercase; }
.brand-mark { width: 54px; height: 54px; display: grid; place-items: center; border-radius: 16px; background: linear-gradient(145deg,#247abb,#8fd0ff); color: #fff; font-size: 20px; font-weight: 900; box-shadow: 0 10px 25px rgba(23,105,170,.28); }
.brand-mark.small { width: 40px; height: 40px; border-radius: 11px; font-size: 15px; }
.sidebar-close { display: none; margin-left: auto; color: #fff; }
.side-section-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 17px 7px; color: rgba(255,255,255,.56); font-size: 10px; font-weight: 850; letter-spacing: .11em; text-transform: uppercase; }
.side-section-head .mini-btn { color: #91d3ff; }
.project-list, .usecase-list { display: grid; gap: 4px; padding: 0 9px; overflow-y: auto; }
.project-list { max-height: 34vh; }
.usecase-list { max-height: 32vh; }
.nav-item { width: 100%; display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 9px; border: 0; border-radius: 9px; background: transparent; color: rgba(255,255,255,.76); padding: 9px; text-align: left; }
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { background: rgba(123,204,255,.16); color: #fff; box-shadow: inset 3px 0 0 #7bccff; }
.nav-token { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px; background: rgba(255,255,255,.09); font-size: 10px; font-weight: 900; }
.nav-copy strong, .nav-copy small { display: block; }
.nav-copy strong { max-width: 155px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.nav-copy small { color: rgba(255,255,255,.48); font-size: 10px; }
.nav-count { border-radius: 999px; background: rgba(255,255,255,.09); padding: 2px 6px; font-size: 9px; font-weight: 850; }
.sidebar-footer { margin-top: auto; padding: 12px; border-top: 1px solid rgba(255,255,255,.11); }
.sidebar-footer > .btn { margin: 5px 0; border-color: rgba(255,255,255,.15); background: rgba(255,255,255,.07); color: #fff; }
.user-button { width: 100%; display: grid; grid-template-columns: 36px 1fr; align-items: center; gap: 10px; border: 0; border-radius: 9px; background: transparent; color: #fff; padding: 7px; text-align: left; }
.user-button:hover { background: rgba(255,255,255,.07); }
.user-button strong, .user-button small { display: block; }
.user-button strong { font-size: 12px; }
.user-button small { color: rgba(255,255,255,.52); font-size: 10px; }
.avatar { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: #78caff; color: var(--navy); font-weight: 900; }
.logout-link { display: block; margin: 4px 8px 0; color: rgba(255,255,255,.55); font-size: 11px; text-decoration: none; }
.logout-link:hover { color: #fff; }

.workspace { min-width: 0; }
.workspace-header { position: sticky; top: 0; z-index: 20; min-height: 74px; display: flex; align-items: center; gap: 14px; padding: 12px 22px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.94); backdrop-filter: blur(12px); }
.menu-btn { display: none; }
.desktop-sidebar-toggle { display: grid; flex: 0 0 auto; }
.breadcrumbs { min-width: 0; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.breadcrumbs span { max-width: 230px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.breadcrumbs span:last-child { color: var(--navy); font-weight: 800; }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.save-state { color: var(--muted); font-size: 11px; }
.save-state.saving { color: var(--amber); }
.save-state.saved { color: var(--green); }
.tabs { position: sticky; top: 74px; z-index: 19; display: flex; gap: 3px; padding: 0 22px; border-bottom: 1px solid var(--line); background: var(--surface); overflow-x: auto; }
.tab { min-height: 47px; border: 0; border-bottom: 3px solid transparent; background: transparent; color: var(--muted); padding: 0 14px; font-size: 12px; font-weight: 800; white-space: nowrap; }
.tab:hover { color: var(--navy); }
.tab.active { border-bottom-color: var(--blue); color: var(--blue); }
.content { padding: 24px; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.page-title-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 18px; }
.page-title-row p { max-width: 850px; margin: 7px 0 0; }
.page-title-row.compact h1 { font-size: 28px; }
.status-badge { border-radius: 999px; background: var(--blue-soft); color: var(--blue); padding: 7px 11px; font-size: 11px; font-weight: 850; }
.filter-row, .diagram-toolbar { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.filter-row input, .filter-row select { min-height: 38px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); padding: 7px 10px; color: var(--ink); }

.metric-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; margin-bottom: 16px; }
.metric { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 15px 16px; box-shadow: 0 4px 15px rgba(16,47,83,.05); }
.metric span, .metric small, .metric strong { display: block; }
.metric span { color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .055em; }
.metric strong { margin: 3px 0; color: var(--navy); font-size: 30px; }
.metric small { color: var(--muted); font-size: 10px; }
.metric.danger strong { color: var(--red); }
.overview-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 16px; margin-bottom: 16px; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.panel-head h2 { font-size: 16px; }
.panel-head p { margin: 3px 0 0; color: var(--muted); font-size: 10px; }
.context-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 0; margin: 0; padding: 8px 16px 16px; }
.context-grid div { padding: 12px 7px; border-bottom: 1px solid var(--line); }
.context-grid dt { color: var(--muted); font-size: 9px; font-weight: 850; letter-spacing: .06em; text-transform: uppercase; }
.context-grid dd { margin: 5px 0 0; font-size: 12px; }
.risk-bars { display: grid; gap: 12px; padding: 17px; }
.risk-bar-row { display: grid; grid-template-columns: 70px 1fr 34px; align-items: center; gap: 10px; font-size: 11px; }
.bar-track { height: 10px; overflow: hidden; border-radius: 999px; background: var(--surface-2); }
.bar-fill { height: 100%; border-radius: inherit; }
.bar-fill.high { background: var(--red); }.bar-fill.medium { background: var(--amber); }.bar-fill.low { background: var(--green); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; font-size: 11px; }
th { color: var(--muted); font-size: 9px; letter-spacing: .055em; text-transform: uppercase; }
tbody tr:hover { background: #fbfcfe; }
.risk-pill { display: inline-flex; align-items: center; border-radius: 999px; padding: 4px 7px; font-size: 9px; font-weight: 900; white-space: nowrap; }
.risk-pill.high { background: var(--red-soft); color: var(--red); }.risk-pill.medium { background: var(--amber-soft); color: var(--amber); }.risk-pill.low { background: var(--green-soft); color: var(--green); }

.scenario-layout { display: grid; grid-template-columns: 330px minmax(0,1fr); gap: 16px; align-items: start; }
.scenario-browser { max-height: calc(100vh - 230px); position: sticky; top: 139px; }
.scenario-browser-list { max-height: calc(100vh - 232px); overflow-y: auto; padding: 7px; }
.scenario-card { width: 100%; display: grid; grid-template-columns: 39px 1fr auto; gap: 10px; align-items: center; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--ink); padding: 11px 8px; text-align: left; }
.scenario-card:hover { background: var(--surface-2); }
.scenario-card.active { border-radius: 9px; background: var(--blue-soft); }
.scenario-code { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 9px; background: var(--surface-2); color: var(--navy); font-size: 9px; font-weight: 900; }
.scenario-card.active .scenario-code { background: var(--navy); color: #fff; }
.scenario-card strong, .scenario-card small { display: block; }
.scenario-card strong { font-size: 12px; }.scenario-card small { color: var(--muted); font-size: 9px; }
.scenario-detail { min-height: 500px; }
.scenario-detail-body { padding: 18px; }
.scenario-title-row { display: flex; justify-content: space-between; gap: 15px; align-items: flex-start; }
.scenario-title-row h2 { font-size: 23px; }
.scenario-title-row p { margin: 6px 0 0; color: var(--muted); }
.scenario-actions { display: flex; gap: 7px; }
.score-box { min-width: 185px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); padding: 10px 12px; }
.score-box strong { display: block; color: var(--navy); font-size: 28px; }
.score-box small { color: var(--muted); font-size: 9px; }
.scenario-section { margin-top: 17px; padding-top: 14px; border-top: 1px solid var(--line); }
.scenario-section h3 { margin: 0 0 8px; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
.scenario-section p { margin: 0; font-size: 12px; }
.scenario-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.step-flow { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.step-chip { border-radius: 8px; background: var(--red-soft); color: var(--red); padding: 7px 9px; font-size: 10px; font-weight: 800; }
.step-arrow { color: var(--red); font-weight: 900; }
.detail-list { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.detail-list li { position: relative; padding-left: 15px; font-size: 11px; }
.detail-list li::before { content: "•"; position: absolute; left: 2px; color: var(--blue); font-weight: 900; }
.detail-list.controls li::before { color: var(--green); }
.empty-inline, .empty-state { text-align: center; color: var(--muted); padding: 60px 20px; }
.empty-inline h3, .empty-state h2 { margin: 0; color: var(--navy); }
.empty-inline p, .empty-state p { margin: 7px auto 16px; max-width: 520px; }
.empty-icon { margin: 0 auto 12px; width: 54px; height: 54px; display: grid; place-items: center; border-radius: 15px; background: var(--blue-soft); color: var(--blue); font-size: 28px; }

.diagram-layout { display: grid; grid-template-columns: minmax(0,1fr) 290px; gap: 14px; align-items: start; }
.diagram-subbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 10px; }
.diagram-subbar label { display: flex; align-items: center; gap: 8px; }
.diagram-subbar select { min-height: 32px; max-width: 300px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); padding: 4px 8px; color: var(--ink); }
.diagram-zoom { display: flex; align-items: center; gap: 5px; }
.diagram-zoom span { min-width: 42px; text-align: center; font-weight: 800; }
.diagram-scroll { overflow: auto; padding: 10px; }
.diagram-canvas { position: relative; min-width: 980px; height: 680px; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: linear-gradient(rgba(23,105,170,.04) 1px,transparent 1px),linear-gradient(90deg,rgba(23,105,170,.04) 1px,transparent 1px),#fbfcfe; background-size: 24px 24px; }
.edge-layer { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2; pointer-events: none; }
.edge { fill: none; stroke-width: 2; opacity: .68; }
.edge.data { stroke: #788da5; marker-end: url(#arrowData); }.edge.attack { stroke: var(--red); stroke-width: 3.3; marker-end: url(#arrowAttack); }.edge.control { stroke: var(--green); stroke-dasharray: 6 4; marker-end: url(#arrowControl); }.edge.trust { stroke: var(--purple); stroke-dasharray: 9 5; marker-end: url(#arrowData); }
.edge.scenario-active { stroke: var(--red); stroke-width: 4.2; opacity: 1; marker-end: url(#arrowAttack); }
.edge-hit { fill: none; stroke: transparent; stroke-width: 14; pointer-events: stroke; cursor: pointer; }
.edge-label { fill: var(--muted); font-size: 10px; font-weight: 750; paint-order: stroke; stroke: #fff; stroke-width: 4px; stroke-linejoin: round; pointer-events: none; }
#arrowData path { fill: #788da5; } #arrowAttack path { fill: var(--red); } #arrowControl path { fill: var(--green); }
.tm-node { position: absolute; z-index: 3; transform: translate(-50%,-50%); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--navy); padding: 8px; text-align: center; box-shadow: 0 5px 16px rgba(16,47,83,.08); user-select: none; cursor: move; }
.tm-node:hover, .tm-node.selected { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(23,105,170,.12),0 8px 20px rgba(16,47,83,.12); }
.tm-node.path-active { border-color: var(--red); background: var(--red-soft); box-shadow: 0 0 0 3px rgba(199,53,50,.12); }
.tm-node.path-pending { border-color: var(--amber); background: var(--amber-soft); }
.tm-node.boundary { z-index: 1; align-items: flex-start; justify-content: flex-start; border-style: dashed; border-color: rgba(112,72,168,.55); background: rgba(112,72,168,.035); box-shadow: none; padding: 11px; }
.tm-node.boundary.path-active { background: rgba(199,53,50,.035); }
.tm-node .node-type { color: var(--muted); font-size: 8px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.tm-node .node-label { max-width: 100%; font-size: 11px; font-weight: 850; line-height: 1.25; }
.tm-node.assurance-mode { border-width: 3px; }
.tm-node.assurance-assured { border-color: var(--green); }.tm-node.assurance-partial { border-color: var(--blue); }.tm-node.assurance-planned { border-color: var(--amber); }.tm-node.assurance-gap { border-color: var(--red); }.tm-node.assurance-not_assessed { border-color: #8a96a8; }
.assurance-badge { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 4px; border-radius: 999px; background: rgba(255,255,255,.86); padding: 2px 6px; font-size: 7px; font-weight: 900; text-transform: uppercase; }
.assurance-legend { position: absolute; right: 12px; bottom: 10px; z-index: 7; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; max-width: 580px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255,255,255,.94); padding: 7px 10px; box-shadow: var(--shadow); color: var(--muted); font-size: 9px; }
.assurance-legend .assured { color: var(--green); }.assurance-legend .partial { color: var(--blue); }.assurance-legend .planned { color: var(--amber); }.assurance-legend .gap { color: var(--red); }.assurance-legend .not_assessed { color: #8a96a8; }
.tm-node.actor { background: var(--purple-soft); border-color: #bba6d8; }.tm-node.asset { background: var(--amber-soft); border-color: #e2bd78; }.tm-node.datastore { border-radius: 50% / 14%; background: #eef7fb; border-color: #87bdd5; }.tm-node.control { background: var(--green-soft); border-color: #7fc3a0; }.tm-node.impact { background: var(--red-soft); border-color: #e0928f; }.tm-node.trust { background: var(--blue-soft); border-color: #8ebfe2; }
.canvas-hint { position: absolute; left: 12px; bottom: 10px; z-index: 5; color: var(--muted); font-size: 9px; pointer-events: none; }
.property-panel { position: sticky; top: 139px; }
.property-body { padding: 14px; }
.property-body label { display: grid; gap: 5px; margin-bottom: 10px; color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.property-body input, .property-body textarea, .property-body select { width: 100%; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--ink); padding: 7px 8px; font-size: 11px; text-transform: none; letter-spacing: 0; font-weight: 500; }
.property-actions { display: flex; gap: 7px; margin-top: 12px; }
.property-divider { display: grid; gap: 2px; margin: 16px -14px 12px; padding: 10px 14px; border-block: 1px solid var(--line); background: var(--surface-2); color: var(--navy); }
.property-divider small { color: var(--muted); font-size: 9px; }
.diagram-toolbar .active-mode { border-color: var(--amber); background: var(--amber-soft); color: var(--amber); }

.io-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 14px; margin-bottom: 16px; }
.ai-card { border-color: #cbbce0; background: linear-gradient(160deg,#fff,#f7f2fc); }
.io-card { padding: 16px; }
.io-card h2 { margin-top: 10px; }
.io-card p { min-height: 80px; color: var(--muted); font-size: 11px; }
.io-card .btn { margin-top: 7px; }
.io-icon { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; background: var(--blue-soft); color: var(--blue); font-size: 23px; font-weight: 900; }
.file-drop { min-height: 70px; display: grid; place-items: center; border: 1px dashed #9fb4cc; border-radius: 9px; background: #fafcff; color: var(--blue); padding: 10px; text-align: center; font-size: 11px; font-weight: 800; }
.file-drop input { width: 100%; margin-top: 7px; color: var(--muted); font-size: 9px; }
.check-row { display: flex; align-items: center; gap: 7px; margin-top: 9px; color: var(--muted); font-size: 10px; }
.code-sample { margin: 0; overflow: auto; padding: 16px; background: #122238; color: #cde8ff; font-size: 11px; }

dialog { width: min(680px,calc(100vw - 30px)); max-height: calc(100vh - 30px); border: 0; border-radius: 15px; background: var(--surface); color: var(--ink); padding: 0; box-shadow: 0 30px 80px rgba(16,47,83,.30); }
dialog::backdrop { background: rgba(9,25,44,.58); backdrop-filter: blur(3px); }
dialog.wide-dialog { width: min(1100px,calc(100vw - 30px)); }
.dialog-form { max-height: calc(100vh - 30px); overflow-y: auto; }
.dialog-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 18px; border-bottom: 1px solid var(--line); background: var(--surface); }
.dialog-head h2 { font-size: 20px; }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; padding: 17px 18px; }
.scenario-form-grid { display: grid; grid-template-columns: 1fr 1fr; }
.scenario-form-grid .form-grid { align-content: start; }
.scenario-form-grid .form-grid + .form-grid { border-left: 1px solid var(--line); }
.form-grid label { display: grid; gap: 5px; color: var(--muted); font-size: 10px; font-weight: 800; }
.form-grid label.check-row { display: flex; align-items: center; }
.form-grid label.check-row input { width: auto; }
.form-grid label small { font-weight: 500; }
.form-grid input, .form-grid textarea, .form-grid select { width: 100%; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); padding: 8px 9px; font-size: 12px; font-weight: 500; resize: vertical; }
.form-grid input:focus, .form-grid textarea:focus, .form-grid select:focus { outline: 3px solid rgba(23,105,170,.13); border-color: var(--blue); }
.ai-assist-strip { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: end; gap: 10px; padding: 12px 18px; border-bottom: 1px solid #d8cce8; background: linear-gradient(135deg,#fbf8ff,#f1f7fd); }
.ai-assist-strip label { display: grid; gap: 5px; color: #604581; font-size: 10px; font-weight: 850; }
.ai-assist-strip input { min-height: 38px; border: 1px solid #cbbce0; border-radius: 8px; background: #fff; padding: 8px 9px; }
.inline-note { border-radius: 8px; background: var(--surface-2); color: var(--muted); padding: 10px; font-size: 10px; }
.ai-results { max-height: 330px; overflow: auto; display: grid; gap: 8px; }
.ai-results article { border: 1px solid var(--line); border-radius: 9px; background: #fff; padding: 10px; }
.ai-results article strong,.ai-results article span { display: block; }.ai-results article span { color: var(--muted); font-size: 9px; }.ai-results article p { margin: 5px 0 0; font-size: 10px; }
.span-2 { grid-column: span 2; }
.dialog-actions { position: sticky; bottom: 0; z-index: 2; display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); background: var(--surface); }
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: none; max-width: 380px; border-radius: 10px; background: var(--navy); color: #fff; padding: 11px 14px; box-shadow: var(--shadow); font-size: 11px; font-weight: 800; }
.toast.show { display: block; }
.toast.error { background: var(--red); }

#tab-threat-model:fullscreen { display: block; overflow: auto; background: var(--bg); padding: 18px; }
#tab-threat-model:fullscreen .threat-title { margin-bottom: 10px; }
#tab-threat-model:fullscreen .diagram-layout { grid-template-columns: minmax(0,1fr) 320px; }
#tab-threat-model:fullscreen .diagram-scroll { height: calc(100vh - 185px); }
#tab-threat-model:fullscreen .diagram-canvas { height: calc(100vh - 220px); min-height: 620px; }
#tab-threat-model:fullscreen .property-panel { position: static; max-height: calc(100vh - 125px); overflow: auto; }

.login-page { display: grid; place-items: center; padding: 25px; background: radial-gradient(circle at 15% 15%,#1e5f93 0,#102f53 38%,#0a1e35 100%); }
.login-shell { width: min(1000px,100%); display: grid; grid-template-columns: 1.15fr .85fr; overflow: hidden; border-radius: 22px; background: var(--surface); box-shadow: 0 30px 90px rgba(0,0,0,.35); }
.login-brand { padding: 50px; background: linear-gradient(150deg,rgba(16,47,83,.98),rgba(23,105,170,.91)); color: #fff; }
.login-brand h1 { margin-top: 16px; color: #fff; }
.login-brand p { color: rgba(255,255,255,.72); }
.login-brand .eyebrow { color: #88d2ff; }
.login-brand ul { margin: 28px 0 0; padding-left: 18px; color: rgba(255,255,255,.76); font-size: 12px; }
.login-brand li { margin: 9px 0; }
.login-card { display: grid; align-content: center; gap: 18px; padding: 45px; }
.login-card h2 { font-size: 27px; }
.login-card form { display: grid; gap: 13px; }
.login-card label { display: grid; gap: 6px; color: var(--muted); font-size: 11px; font-weight: 800; }
.login-card input { border: 1px solid var(--line); border-radius: 9px; padding: 10px; }
.login-help { color: var(--muted); font-size: 10px; }
.alert { border-radius: 8px; padding: 9px 11px; font-size: 11px; font-weight: 700; }.alert.error { background: var(--red-soft); color: var(--red); }

@media (max-width: 1250px) {
  .io-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .diagram-layout { grid-template-columns: 1fr; }
  .property-panel { position: static; }
}
@media (max-width: 1000px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; left: 0; transform: translateX(-105%); transition: transform .2s ease; }
  .app-shell.sidebar-collapsed .sidebar { opacity: 1; pointer-events: auto; transform: translateX(-105%); }
  .sidebar.open { transform: translateX(0); }
  .app-shell.sidebar-collapsed .sidebar.open { transform: translateX(0); }
  .sidebar-close, .menu-btn { display: grid; }
  .desktop-sidebar-toggle { display: none; }
  .metric-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .scenario-layout { grid-template-columns: 1fr; }
  .scenario-browser { position: static; max-height: none; }
  .scenario-browser-list { max-height: 320px; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
  .scenario-card { border-right: 1px solid var(--line); }
}
@media (max-width: 720px) {
  .workspace-header { padding: 10px 12px; }
  .breadcrumbs { display: none; }
  .header-actions .save-state, .header-actions .subtle { display: none; }
  .tabs { top: 66px; padding: 0 8px; }
  .content { padding: 14px; }
  .page-title-row { flex-direction: column; }
  .metric-grid, .overview-grid, .io-grid, .scenario-two-col { grid-template-columns: 1fr; }
  .scenario-browser-list { grid-template-columns: 1fr; }
  .context-grid { grid-template-columns: 1fr; }
  .scenario-title-row { flex-direction: column; }
  .scenario-form-grid, .form-grid { grid-template-columns: 1fr; }
  .ai-assist-strip { grid-template-columns: 1fr; }
  .scenario-form-grid .form-grid + .form-grid { border-left: 0; border-top: 1px solid var(--line); }
  .span-2 { grid-column: auto; }
  .login-page { padding: 0; }
  .login-shell { min-height: 100vh; grid-template-columns: 1fr; border-radius: 0; }
  .login-brand { display: none; }
  .login-card { padding: 28px; }
}

@media print {
  .sidebar, .workspace-header, .tabs, .diagram-toolbar, .property-panel, .toast { display: none !important; }
  .app-shell { display: block; }
  .content { padding: 0; }
  .panel { box-shadow: none; break-inside: avoid; }
}
