:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #07101d;
  color: #eaf1fb;
  --bg: #07101d;
  --panel: #0d1727;
  --panel-2: #101d30;
  --panel-3: #13243a;
  --line: #22344f;
  --line-soft: #192943;
  --muted: #8292aa;
  --muted-2: #596a82;
  --text: #eaf1fb;
  --accent: #5aa8ff;
  --accent-strong: #2782dd;
  --accent-soft: #173b61;
  --ok: #69d5ae;
  --warn: #f0c96b;
  --danger: #ff858d;
  --rail: 58px;
  --topbar: 54px;
  --inspector: 352px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); }
body { min-height: 100vh; overflow: hidden; }
button, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .42; }
h1, h2, h3, p { margin-top: 0; }
h1 { letter-spacing: -.025em; }
h2 { font-size: .98rem; }
.hidden { display: none !important; }
.muted-copy { color: var(--muted); line-height: 1.5; }
.hint { color: var(--muted); font-size: .76rem; line-height: 1.45; }
.eyebrow { text-transform: uppercase; letter-spacing: .15em; font-size: .62rem; color: var(--muted); }
.row { display: flex; align-items: center; flex-wrap: wrap; }
.gap { gap: 9px; }

.brand-lockup { display: inline-flex; align-items: baseline; gap: 8px; white-space: nowrap; }
.brand-lockup.centered { justify-content: center; width: 100%; }
.product-name { font-size: 1.06rem; font-weight: 720; letter-spacing: -.02em; color: #edf5ff; }
.brand-divider { color: #405069; font-weight: 300; }
.qvert-signature {
  font-family: "Segoe Script", "Brush Script MT", "Lucida Handwriting", cursive;
  font-size: .78rem;
  font-style: italic;
  color: #56667b;
  transform: rotate(-2deg);
}

.auth-portal {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    radial-gradient(circle at 18% 17%, rgba(38, 100, 166, .18), transparent 34%),
    radial-gradient(circle at 80% 80%, rgba(40, 118, 102, .11), transparent 31%),
    #07101d;
}
.auth-panel {
  width: min(650px, 100%);
  padding: 46px 48px;
  border: 1px solid #263957;
  border-radius: 22px;
  background: rgba(12, 23, 40, .96);
  box-shadow: 0 30px 90px rgba(0, 0, 0, .42);
}
.compact-auth-panel { width: min(410px, 100%); text-align: center; }
.auth-kicker { margin-top: 28px; color: var(--accent); text-transform: uppercase; letter-spacing: .14em; font-size: .66rem; }
.auth-panel h1 { margin: 10px 0 16px; max-width: 570px; font-size: clamp(2rem, 5vw, 3.05rem); line-height: 1.03; }
.auth-copy { max-width: 560px; color: #aab8cb; font-size: 1.02rem; line-height: 1.58; margin-bottom: 26px; }
.auth-button { width: 100%; min-height: 48px; font-size: .96rem; }
.auth-hint { margin: 14px 0 0; }
.auth-foot { display: flex; gap: 14px; align-items: center; justify-content: space-between; margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--line-soft); }
.loading-orbit { width: 28px; height: 28px; margin: 28px auto 14px; border: 2px solid #27415f; border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.button, .icon-button, .user-chip {
  border: 1px solid var(--line);
  color: var(--text);
  background: #15243a;
  text-decoration: none;
}
.button {
  min-height: 36px;
  border-radius: 8px;
  padding: 8px 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}
.button.compact { min-height: 32px; padding: 6px 10px; font-size: .77rem; }
.button.primary { background: #1e68ad; border-color: #347ec2; }
.button.secondary { background: #142239; }
.button.ghost { background: transparent; }
.button:hover:not(:disabled), .icon-button:hover:not(:disabled) { filter: brightness(1.14); }
.icon-button {
  width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px; padding: 0;
}
.badge, .status, .trial-badge, .context-pill, .kind-badge, .count-badge {
  border: 1px solid var(--line);
  border-radius: 999px;
  white-space: nowrap;
}
.badge, .status { padding: 4px 8px; font-size: .68rem; color: var(--muted); }
.badge.subtle { border-color: var(--line-soft); color: #65758b; }
.status.ok { color: var(--ok); border-color: #2c6757; }
.status.warn { color: var(--warn); border-color: #665733; }
.status.error { color: var(--danger); border-color: #713a43; }

.app-shell { min-height: 100vh; }
.topbar {
  height: var(--topbar);
  display: grid;
  grid-template-columns: minmax(180px, 280px) minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 0 14px 0 17px;
  border-bottom: 1px solid var(--line);
  background: #0a1423;
  position: relative;
  z-index: 20;
}
.topbar-brand .product-name { font-size: 1rem; }
.topbar-context { min-width: 0; display: flex; align-items: center; justify-content: center; gap: 8px; }
.context-pill { padding: 5px 9px; color: #9db1c9; background: #0c192b; font-size: .68rem; max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
.context-pill.muted { color: #708198; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.trial-badge { padding: 5px 10px; color: var(--warn); border-color: #68582d; background: #1b1b16; font-size: .68rem; }
.trial-badge.expired { color: var(--danger); border-color: #6c363e; background: #21151a; }
.user-chip {
  min-height: 38px;
  border-radius: 9px;
  padding: 4px 8px 4px 5px;
  display: flex;
  align-items: center;
  gap: 7px;
  text-align: left;
}
.user-avatar {
  width: 28px; height: 28px; border-radius: 7px; display: grid; place-items: center;
  background: #163456; color: #a9d4ff; border: 1px solid #315d87; font-weight: 700; font-size: .72rem;
}
.user-chip-copy { display: grid; line-height: 1.1; }
.user-chip-copy strong { font-size: .7rem; max-width: 130px; overflow: hidden; text-overflow: ellipsis; }
.user-chip-copy small { font-size: .59rem; color: var(--muted); margin-top: 3px; }

.workspace-frame { height: calc(100vh - var(--topbar)); display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); }
.tool-rail {
  min-height: 0;
  padding: 8px 6px;
  border-right: 1px solid var(--line);
  background: #091321;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.tool-button {
  width: 46px; min-height: 45px; padding: 5px 2px;
  border: 1px solid transparent; border-radius: 9px;
  background: transparent; color: #6f8199;
  display: grid; place-items: center; gap: 1px;
}
.tool-button:hover, .tool-button.active { color: #dcecff; background: #11233a; border-color: #203b5c; }
.tool-button.active { box-shadow: inset 2px 0 0 var(--accent); }
.tool-glyph { font-size: 1rem; line-height: 1; }
.tool-label { font-size: .52rem; letter-spacing: .02em; }
.tool-rail-spacer { flex: 1; }

.workspace-content { min-width: 0; min-height: 0; overflow: hidden; background: #08111e; }
.work-view { display: none; height: 100%; min-height: 0; overflow: auto; }
.work-view.active { display: block; }
#topologyView.active { display: grid; grid-template-rows: auto auto minmax(0, 1fr); overflow: hidden; }

.map-commandbar {
  min-height: 48px;
  display: grid;
  grid-template-columns: auto minmax(240px, 520px) 1fr;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
  background: #0c1727;
}
.command-group { display: flex; align-items: center; gap: 7px; }
.map-actions { justify-content: flex-end; }
.compact-field { min-width: 0; display: grid; grid-template-columns: auto minmax(0,1fr); align-items: center; gap: 7px; }
.compact-field span { color: var(--muted); font-size: .64rem; text-transform: uppercase; letter-spacing: .07em; }
select {
  min-width: 0; width: 100%;
  background: #081321; border: 1px solid var(--line); border-radius: 7px; color: #dce7f4;
  padding: 7px 9px; font-size: .74rem;
}
.baseline-strip {
  min-height: 35px;
  display: grid;
  grid-template-columns: minmax(230px, auto) minmax(120px, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 5px 10px;
  border-bottom: 1px solid var(--line-soft);
  background: #091421;
}
.baseline-state { display: flex; align-items: center; gap: 8px; min-width: 0; }
.baseline-state .hint { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress { height: 4px; background: #07101b; border-radius: 999px; overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: linear-gradient(90deg, #2f77c8, #62b9f6); transition: width .2s ease; }
.inline-metrics { display: flex; align-items: center; gap: 11px; color: var(--muted); font-size: .62rem; }
.inline-metrics strong { color: #dcecff; font-weight: 650; }

.topology-workspace { min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) var(--inspector); }
.canvas-wrap { min-width: 0; min-height: 0; position: relative; overflow: hidden; background:
  linear-gradient(rgba(48, 73, 102, .08) 1px, transparent 1px),
  linear-gradient(90deg, rgba(48, 73, 102, .08) 1px, transparent 1px),
  #07101c;
  background-size: 28px 28px;
}
#topologySvg { width: 100%; height: 100%; min-height: 420px; display: block; touch-action: none; }
.canvas-empty { position: absolute; inset: 0; display: grid; place-items: center; padding: 32px; pointer-events: none; }
.empty-state { max-width: 380px; display: grid; justify-items: center; gap: 8px; text-align: center; color: var(--muted); }
.empty-state strong { color: #d9e7f8; font-size: .92rem; }
.empty-state span { font-size: .76rem; line-height: 1.45; }
.empty-icon { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid #28496c; border-radius: 12px; color: #80bfff; background: #0d2035; }
.canvas-watermark { position: absolute; left: 13px; bottom: 9px; color: rgba(117, 143, 173, .18); font-size: .64rem; text-transform: uppercase; letter-spacing: .24em; pointer-events: none; }

.side-pane { min-width: 0; min-height: 0; padding: 13px; border-left: 1px solid var(--line); background: #0a1525; overflow: auto; }
.side-pane-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; padding-bottom: 9px; border-bottom: 1px solid var(--line-soft); }
.side-pane-heading h2 { margin: 3px 0 0; font-size: .9rem; }
.inspector-hint { margin-top: 13px; }
.kind-badge { padding: 4px 8px; background: #10253c; color: #88bff0; border-color: #284d72; font-size: .61rem; }
.resource-heading { display: flex; align-items: center; gap: 9px; margin: 13px 0; }
.resource-heading-icon { width: 38px; height: 38px; flex: 0 0 auto; }
.resource-heading h3 { margin: 0; font-size: .9rem; overflow-wrap: anywhere; }
.resource-heading small { display: block; margin-top: 3px; color: var(--muted); font-size: .64rem; }
.detail-list { display: grid; gap: 1px; border: 1px solid var(--line-soft); border-radius: 8px; overflow: hidden; background: var(--line-soft); }
.detail-list div { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 8px; padding: 7px 8px; background: #0c192a; font-size: .68rem; }
.detail-list span:first-child { color: var(--muted); }
.detail-list span:last-child { overflow-wrap: anywhere; }
.detail-section { margin-top: 13px; padding-top: 11px; border-top: 1px solid var(--line-soft); }
.detail-section h3 { margin-bottom: 7px; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: #a4b7ce; }
.relationship-item { padding: 7px 8px; border: 1px solid var(--line-soft); border-radius: 7px; margin-top: 5px; background: #0b1828; font-size: .65rem; overflow-wrap: anywhere; }
.side-pane pre { max-height: 250px; overflow: auto; margin: 0; padding: 8px; border-radius: 7px; background: #050c16; color: #9fb0c6; font: 10px/1.45 ui-monospace, SFMono-Regular, Consolas, monospace; }

.qvert-container { fill: rgba(53, 78, 109, .055); stroke: #29415d; stroke-width: 1; rx: 10; ry: 10; pointer-events: none; }
.qvert-container-label { fill: #617893; font-size: 10px; pointer-events: none; }
.qvert-edge { stroke: #4e6d8d; stroke-width: 1.1; opacity: .52; pointer-events: none; }
.qvert-resource { cursor: pointer; outline: none; }
.qvert-node { fill: #10233a; stroke: #397ab8; stroke-width: 1.1; rx: 8; ry: 8; }
.qvert-resource:hover .qvert-node { stroke: #79b9ef; stroke-width: 1.8; }
.qvert-resource:focus .qvert-node, .qvert-node.selected { fill: #17385a; stroke: #a4d5ff; stroke-width: 2.2; }
.qvert-node-label { fill: #e8f2fc; font-size: 10px; font-weight: 600; pointer-events: none; }
.qvert-node-type { fill: #7189a5; font-size: 8px; pointer-events: none; }
.tn-icon-frame { fill: #0c1b2c; stroke: #294e73; stroke-width: 1; }
.tn-icon-line { fill: none; stroke: #72b9ef; stroke-width: 1.35; stroke-linecap: round; stroke-linejoin: round; }
.tn-icon-security .tn-icon-frame { fill: #15251f; stroke: #386354; }
.tn-icon-security .tn-icon-line { stroke: #78d1ae; }
.tn-icon-storage .tn-icon-frame, .tn-icon-database .tn-icon-frame { fill: #1b1c2e; stroke: #4c4e79; }
.tn-icon-storage .tn-icon-line, .tn-icon-database .tn-icon-line { stroke: #a7a9ef; }
.tn-icon-app .tn-icon-frame, .tn-icon-container .tn-icon-frame { fill: #1a2230; stroke: #4a596d; }
.tn-icon-app .tn-icon-line, .tn-icon-container .tn-icon-line { stroke: #b2c3d8; }
.tn-icon-identity .tn-icon-frame { fill: #251d28; stroke: #654667; }
.tn-icon-identity .tn-icon-line { stroke: #d6a6db; }

.page-heading {
  min-height: 92px;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 20px;
  padding: 20px 24px 15px;
  border-bottom: 1px solid var(--line);
  background: #0a1423;
}
.page-heading h1 { margin: 4px 0 5px; font-size: 1.45rem; }
.page-heading p { margin: 0; max-width: 780px; color: var(--muted); font-size: .78rem; line-height: 1.45; }
.dashboard-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 13px; padding: 16px; }
.connection-dashboard { grid-template-columns: minmax(300px, .85fr) minmax(380px, 1.15fr); }
.panel, .kb-card {
  border: 1px solid var(--line); border-radius: 11px; background: var(--panel); box-shadow: 0 10px 25px rgba(0,0,0,.14);
}
.panel { padding: 16px; }
.panel-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.panel-heading h2 { margin: 4px 0 0; font-size: .95rem; }
.panel-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.fact-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; margin: 14px 0 0; }
.fact-grid div { min-width: 0; padding: 9px; border: 1px solid var(--line-soft); border-radius: 8px; background: #0b1829; }
.fact-grid dt { color: var(--muted); font-size: .6rem; text-transform: uppercase; letter-spacing: .07em; }
.fact-grid dd { margin: 4px 0 0; font-size: .72rem; overflow-wrap: anywhere; }
.count-badge { min-width: 25px; height: 25px; padding: 4px 7px; display: grid; place-items: center; color: #9ccaff; border-color: #294b6c; background: #10243a; font-size: .66rem; }
.connection-library { display: grid; gap: 7px; margin-top: 13px; max-height: 420px; overflow: auto; }
.connection-item { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 10px; align-items: center; padding: 10px; border: 1px solid var(--line-soft); border-radius: 8px; background: #0a1727; }
.connection-item.active { border-color: #315f89; background: #0d2035; }
.connection-item strong { display: block; font-size: .74rem; }
.connection-item small { display: block; margin-top: 3px; color: var(--muted); font-size: .62rem; overflow-wrap: anywhere; }
.connection-item-actions { display: flex; gap: 5px; }
.library-note { margin: 11px 0 0; }
.mini-metrics { display: flex; gap: 9px; margin-top: 13px; }
.mini-metrics span { padding: 8px 10px; border: 1px solid var(--line-soft); border-radius: 8px; color: var(--muted); font-size: .68rem; }
.mini-metrics strong { color: #dcecff; }
.locked-capability { opacity: .82; }

.trial-panel { position: relative; overflow: hidden; }
.trial-meter { height: 5px; margin: 15px 0 10px; overflow: hidden; border-radius: 999px; background: #07111d; }
.trial-meter div { height: 100%; width: 100%; background: linear-gradient(90deg, #5aabf7, #70d2aa); transition: width .2s ease; }
.entitlement-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px; margin: 13px 0; }
.entitlement-grid div { padding: 9px; border: 1px solid var(--line-soft); border-radius: 8px; background: #0a1727; }
.entitlement-grid span { display: block; color: var(--muted); font-size: .62rem; }
.entitlement-grid strong { display: block; margin-top: 3px; font-size: .7rem; color: var(--ok); }
.entitlement-grid strong.locked { color: var(--danger); }

.kb-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; padding: 16px; }
.kb-card { min-height: 165px; padding: 17px; position: relative; }
.kb-index { position: absolute; right: 14px; top: 11px; font: 700 1.7rem/1 ui-monospace, monospace; color: rgba(91, 135, 180, .18); }
.kb-card h2 { margin: 23px 0 8px; }
.kb-card p { margin: 0; color: var(--muted); font-size: .76rem; line-height: 1.5; }

.trace-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(760px, 94vw);
  padding: 17px; border-left: 1px solid var(--line); background: #050b13;
  z-index: 50; transform: translateX(102%); transition: transform .18s ease;
  box-shadow: -18px 0 40px rgba(0,0,0,.3);
}
.trace-drawer.open { transform: translateX(0); }
.trace-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.diagnostics-state { display: flex; align-items: center; gap: 9px; margin: 10px 0 4px; flex-wrap: wrap; }
.trace-actions { margin: 10px 0; }
.trace-drawer pre { height: calc(100vh - 186px); overflow: auto; white-space: pre-wrap; word-break: break-word; margin: 0; padding: 11px; background: #02070d; border: 1px solid var(--line); border-radius: 8px; color: #a9b9ce; font: 10px/1.45 ui-monospace,SFMono-Regular,Consolas,monospace; }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 80; max-width: min(620px,90vw); padding: 9px 13px; border: 1px solid var(--line); border-radius: 8px; background: #14243a; color: #edf5ff; box-shadow: 0 8px 24px rgba(0,0,0,.35); font-size: .76rem; }

@media (max-width: 1100px) {
  :root { --inspector: 310px; }
  .map-commandbar { grid-template-columns: auto minmax(190px, 1fr); }
  .map-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .baseline-strip { grid-template-columns: 1fr; }
  .inline-metrics { display: none; }
  .connection-dashboard { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  body { overflow: auto; }
  .topbar { grid-template-columns: 1fr auto; }
  .topbar-context { display: none; }
  .workspace-frame { height: auto; min-height: calc(100vh - var(--topbar)); }
  .workspace-content { overflow: visible; }
  #topologyView.active { min-height: calc(100vh - var(--topbar)); }
  .topology-workspace { grid-template-columns: 1fr; min-height: 720px; }
  .side-pane { border-left: 0; border-top: 1px solid var(--line); max-height: 360px; }
  .dashboard-grid, .kb-grid { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  :root { --rail: 49px; }
  .auth-panel { padding: 32px 24px; }
  .auth-foot { align-items: flex-start; flex-direction: column; }
  .topbar { padding-left: 11px; }
  .qvert-signature { display: none; }
  .brand-divider { display: none; }
  .user-chip-copy { display: none; }
  .tool-button { width: 37px; }
  .tool-label { font-size: .48rem; }
  .map-commandbar { grid-template-columns: 1fr; }
  .connection-command, .map-actions { justify-content: flex-start; }
  .compact-field { grid-template-columns: 1fr; }
  .fact-grid, .entitlement-grid { grid-template-columns: 1fr; }
  .page-heading { align-items: flex-start; flex-direction: column; }
}
