.app-layer-dock {
  position: fixed;
  z-index: 140;
  top: 16px;
  left: 50%;
  display: flex;
  width: max-content;
  max-width: calc(100vw - 120px);
  padding: 4px;
  border: 1px solid rgba(32, 30, 29, .06);
  border-radius: 18px;
  background: rgba(237, 236, 233, .92);
  box-shadow: 0 12px 36px rgba(32, 30, 29, .12);
  gap: 2px;
  transform: translateX(-50%);
  backdrop-filter: blur(18px);
}

.app-layer-tab {
  min-height: 38px;
  padding: 0 16px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: #686563;
  font: 550 13px/1 "Geist", ui-sans-serif, sans-serif;
  white-space: nowrap;
  cursor: pointer;
  transition: background .18s ease, color .18s ease, box-shadow .18s ease;
}

.app-layer-tab:hover { color: #201e1d; }
.app-layer-tab[aria-selected="true"] {
  background: #fff;
  box-shadow: 0 2px 8px rgba(32, 30, 29, .12);
  color: #201e1d;
}
.app-layer-tab:focus-visible { outline: 2px solid #201e1d; outline-offset: 1px; }

.app-layer-panel {
  position: fixed;
  z-index: 130;
  inset: 0;
  display: none;
  min-width: 0;
  padding-left: 96px;
  background: #f7f6f4;
  color: #201e1d;
  grid-template-columns: 290px minmax(0, 1fr);
  overflow: hidden;
}
.app-layer-panel.open { display: grid; }
body.app-layer-open { overflow: hidden !important; }
body.app-layer-open .app-primary-surface { display: none !important; }
body.app-layer-open .floating-nav { z-index: 150; }

.context-nav { display: flex; min-height: 0; padding: 88px 22px 28px; border-right: 1px solid #dedbd7; background: #f1f0ed; flex-direction: column; gap: 10px; overflow-y: auto; }
.context-nav-title { margin: 0; font-size: 26px; font-weight: 570; letter-spacing: -.045em; line-height: 1.05; }
.context-nav-definition { margin: 0 0 14px; color: #6d6966; font-size: 12px; line-height: 1.55; }
.context-nav-list { display: grid; padding-top: 16px; border-top: 1px solid #dedbd7; gap: 4px; }
.context-nav-item { display: flex; width: 100%; min-height: 40px; padding: 0 10px; border: 1px solid transparent; border-radius: 10px; background: transparent; color: #4f4b48; align-items: center; gap: 10px; font: 560 13px/1 "Geist", ui-sans-serif, sans-serif; text-align: left; cursor: pointer; }
.context-nav-item svg { width: 16px; height: 16px; flex: none; }
.context-nav-item span { flex: 1; }
.context-nav-item em { padding: 3px 7px; border-radius: 999px; background: #e4e2de; color: #6d6966; font-size: 10px; font-style: normal; font-weight: 600; }
.context-nav-item:hover { background: #e9e7e4; color: #201e1d; }
.context-nav-item[aria-current="true"] { border-color: #dedbd7; background: #fff; box-shadow: 0 2px 10px rgba(32,30,29,.06); color: #201e1d; }
.context-nav-item[aria-current="true"] em { background: #1b1918; color: #dfff68; }
.context-nav-sub { display: grid; margin: 4px 0 8px 18px; padding-left: 12px; border-left: 1px dashed #cfccc8; gap: 2px; }
.context-nav-sub button { display: grid; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; background: transparent; color: #4f4b48; text-align: left; cursor: pointer; font: inherit; gap: 2px; }
.context-nav-sub button span { font-size: 12px; font-weight: 560; }
.context-nav-sub button small { color: #8a8581; font: 10px/1.3 "SFMono-Regular", Consolas, monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.context-nav-sub button:hover { background: #e9e7e4; }
.context-nav-sub button[aria-current="true"] { background: #1b1918; color: #fff; }
.context-nav-sub button[aria-current="true"] small { color: #dfff68; }

.context-main { display: grid; min-width: 0; min-height: 0; grid-template-rows: auto auto minmax(0, 1fr); }
.app-layer-panel-header {
  display: flex;
  padding: 92px 36px 20px;
  border-bottom: 1px solid #dedbd7;
  align-items: flex-start;
  gap: 24px;
}
.app-layer-panel-header p { max-width: 700px; margin: 6px 0 0; color: #6d6966; font-size: 14px; }
.app-layer-title { margin: 2px 0 0; font-size: clamp(24px, 3vw, 36px); font-weight: 570; letter-spacing: -.04em; line-height: 1.06; }
.app-layer-subbar {
  display: flex;
  min-height: 58px;
  padding: 9px 36px;
  border-bottom: 1px solid #dedbd7;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.app-layer-meta { color: #77726f; font-size: 12px; }
.app-layer-view-toggle {
  display: flex;
  padding: 3px;
  border-radius: 12px;
  background: #e9e7e4;
}
.app-layer-view-toggle button {
  display: flex;
  min-height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #696562;
  align-items: center;
  gap: 7px;
  font: 600 12px/1 "Geist", ui-sans-serif, sans-serif;
  cursor: pointer;
}
.app-layer-view-toggle button.active { background: #fff; box-shadow: 0 1px 5px rgba(32,30,29,.12); color: #201e1d; }
.app-layer-view-toggle svg { width: 14px; height: 14px; }

.app-layer-content { min-height: 0; overflow: auto; }
.app-layer-section { padding: 28px 36px 54px; }
.source-switch { display: none; margin-bottom: 14px; gap: 6px; overflow-x: auto; }
.source-switch button { flex: none; padding: 8px 12px; border: 1px solid #dedbd7; border-radius: 999px; background: #fff; color: #4f4b48; font: 560 12px/1 "Geist", ui-sans-serif, sans-serif; cursor: pointer; }
.source-switch button[aria-current="true"] { border-color: #1b1918; background: #1b1918; color: #fff; }
.app-layer-glossary { display: grid; padding: 28px 36px 54px; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: start; }
.glossary-card { display: flex; padding: 22px; border: 1px solid #dedbd7; border-radius: 10px; background: #fff; flex-direction: column; gap: 12px; }
.glossary-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.glossary-card h3 { margin: 0; font-size: 19px; font-weight: 590; letter-spacing: -.025em; }
.glossary-unit { padding: 3px 7px; border-radius: 999px; background: #f0eeeb; color: #6d6966; font-size: 10px; font-weight: 600; white-space: nowrap; }
.glossary-card p { margin: 0; color: #686563; font-size: 13px; line-height: 1.55; }
.glossary-aliases, .glossary-related { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.glossary-aliases > span, .glossary-related > span, .glossary-formula > span, .glossary-example b { color: #8a8581; font-size: 10px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; }
.glossary-aliases em { padding: 3px 8px; border: 1px solid #e3e0dc; border-radius: 999px; color: #4f4b48; font-size: 11px; font-style: normal; }
.glossary-related i { padding: 3px 8px; border-radius: 5px; background: #f0eeeb; color: #4f4b48; font-size: 11px; font-style: normal; }
.glossary-formula { display: grid; padding: 12px 14px; border-radius: 8px; background: #1b1918; gap: 6px; }
.glossary-formula > span { color: #9f9b97; }
.glossary-formula code { color: #dfff68; font: 12px/1.6 "SFMono-Regular", Consolas, "Liberation Mono", monospace; white-space: pre-wrap; }
.glossary-sql { border: 1px solid #e3e0dc; border-radius: 8px; background: #f6f5f2; overflow: hidden; }
.glossary-sql header { display: flex; padding: 9px 12px; border-bottom: 1px solid #e3e0dc; align-items: center; gap: 10px; }
.glossary-sql header > span { color: #8a8581; font-size: 10px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; }
.glossary-sql header div { display: flex; flex-wrap: wrap; gap: 5px; }
.glossary-sql header code { padding: 3px 7px; border: 1px solid #dedbd7; border-radius: 5px; background: #fff; color: #201e1d; font: 600 10px/1.3 "SFMono-Regular", Consolas, monospace; }
.glossary-sql pre { margin: 0; padding: 12px 14px; overflow-x: auto; color: #4f4b48; font: 11.5px/1.65 "SFMono-Regular", Consolas, "Liberation Mono", monospace; }
.glossary-sql .sql-keyword { color: #201e1d; font-weight: 700; }
.glossary-sql .sql-table { padding: 1px 4px; border-radius: 4px; background: #1b1918; color: #dfff68; font-weight: 500; }
.glossary-sql .sql-string { color: #3d704b; }
.glossary-sql .sql-param { color: #92562f; }
.glossary-example { display: grid; gap: 4px; }
.glossary-meta { display: flex; margin-top: 4px; padding-top: 12px; border-top: 1px solid #ebe9e6; justify-content: space-between; gap: 12px; color: #8a8581; font-size: 10px; }

.source-card-icon { display: grid; width: 34px; height: 34px; flex: 0 0 34px; border-radius: 9px; background: #f0eeeb; color: #3d3a37; place-items: center; }
.source-card-icon svg { width: 16px; height: 16px; }
.source-card-status { display: flex; padding: 4px 8px; border: 1px solid #e3e0dc; border-radius: 999px; align-items: center; gap: 6px; color: #5f5b58; font-size: 10px; font-weight: 600; }
.source-card-dot { width: 6px; height: 6px; border-radius: 50%; background: #5f9d5a; }

.source-detail { min-width: 0; border: 1px solid #dedbd7; border-radius: 12px; background: #fff; overflow: hidden; }
.source-detail-head { display: flex; padding: 22px 24px 16px; align-items: flex-start; justify-content: space-between; gap: 20px; }
.source-detail-head h3 { margin: 0 0 4px; font-size: 22px; font-weight: 590; letter-spacing: -.03em; }
.source-detail-head p { max-width: 560px; margin: 0; color: #686563; font-size: 13px; line-height: 1.5; }
.source-detail-meta { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 10px; color: #8a8581; font-size: 11px; }
.source-view-tabs { display: flex; padding: 0 24px; border-bottom: 1px solid #ebe9e6; gap: 22px; }
.source-view-tabs button { padding: 12px 2px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: #6d6966; font: 550 13px/1 "Geist", ui-sans-serif, sans-serif; cursor: pointer; }
.source-view-tabs button[aria-selected="true"] { border-color: #201e1d; color: #201e1d; }
.source-view-body { padding: 20px 24px 24px; background: #f7f6f4; }

.source-json { display: grid; gap: 14px; }
.source-json.with-card { grid-template-columns: 250px minmax(0, 1fr); align-items: start; }
.source-product-card { border: 1px solid #dedbd7; border-radius: 10px; background: #fff; overflow: hidden; }
.source-product-card img { display: block; width: 100%; height: 280px; background: #ecebe8; object-fit: cover; object-position: top; }
.source-product-placeholder { display: grid; height: 180px; background: #ecebe8; color: #8a8581; place-items: center; }
.source-product-placeholder svg { width: 34px; height: 34px; }
.source-product-card > div:last-child { display: grid; padding: 14px; gap: 8px; }
.source-product-chip { width: fit-content; padding: 3px 8px; border-radius: 999px; background: #f0eeeb; color: #5f5b58; font-size: 10px; }
.source-product-card strong { font-size: 14px; line-height: 1.35; }
.source-product-card small { color: #8a8581; font-size: 11px; }
.source-json-panel { min-width: 0; border: 1px solid #e3e0dc; border-radius: 10px; background: #fff; overflow: hidden; }
.source-json-panel header { display: flex; padding: 8px 10px 8px 16px; border-bottom: 1px solid #ebe9e6; align-items: center; justify-content: space-between; gap: 12px; color: #77726f; font-size: 11px; }
.source-json-view { display: none; }
.source-json-view.active { display: block; }
.source-json-panel .app-layer-tree-wrap { height: 560px; min-height: 0; }
.source-json-panel .app-layer-tree-stage { padding: 30px 60px 70px 28px; }
.source-json-panel .app-layer-code { height: auto; max-height: 560px; padding: 18px; }

.source-table-wrap { display: grid; gap: 8px; }
.source-tables { display: grid; gap: 18px; }
.source-table-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.source-table-picker button { display: inline-flex; padding: 8px 12px; border: 1px solid #dedbd7; border-radius: 999px; background: #fff; color: #4f4b48; align-items: center; gap: 7px; font: 560 12px/1 "SFMono-Regular", Consolas, "Liberation Mono", monospace; cursor: pointer; }
.source-table-picker button:hover { border-color: #b9b5b0; }
.source-table-picker button[aria-selected="true"] { border-color: #1b1918; background: #1b1918; color: #dfff68; }
.source-table-picker svg { width: 13px; height: 13px; }
.source-tables .source-table-engine, .source-tables .source-table-name { display: none; }
.source-table-engine { color: #78736f; font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.source-table-name { font: 600 15px/1.3 "SFMono-Regular", Consolas, "Liberation Mono", monospace; }
.source-table-scroll { margin-top: 6px; border: 1px solid #e3e0dc; border-radius: 10px; background: #fff; overflow-x: auto; }
.source-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.source-table th { padding: 13px 14px; border-bottom: 1px solid #ebe9e6; color: #7b7672; font-size: 10px; font-weight: 600; letter-spacing: .06em; text-align: left; text-transform: uppercase; white-space: nowrap; }
.source-table td { padding: 12px 14px; border-bottom: 1px solid #f0eeeb; color: #2c2927; white-space: nowrap; }
.source-table tr:last-child td { border-bottom: 0; }
.source-table td.is-rejected { color: #b0572c; font-weight: 600; }
.source-table-chips { display: flex; margin-top: 6px; flex-wrap: wrap; gap: 6px; }
.source-table-chips span { display: inline-flex; padding: 5px 10px; border: 1px solid #e3e0dc; border-radius: 999px; background: #fff; gap: 6px; color: #6d6966; font-size: 11px; }
.source-table-chips b { color: #201e1d; font-weight: 600; }

.source-graph { border: 1px solid #e3e0dc; border-radius: 10px; background-color: #fbfaf8; background-image: radial-gradient(#dcd9d5 1px, transparent 1px); background-size: 22px 22px; overflow: hidden; }
.source-graph header { display: flex; padding: 12px 18px; border-bottom: 1px solid #ebe9e6; background: #fbfaf8; align-items: center; gap: 18px; color: #4f4b48; font-size: 12px; }
.source-graph header span { display: flex; align-items: center; gap: 7px; }
.source-graph header em { margin-left: auto; color: #8a8581; font-size: 11px; font-style: normal; }
.source-graph .dot { width: 9px; height: 9px; border-radius: 50%; }
.source-graph .dot.product { background: #1b1918; box-shadow: inset 0 0 0 2px #dfff68; }
.source-graph .dot.concept { border: 1px solid #aaa6a2; background: #fbfaf8; }
.source-graph svg { display: block; width: 100%; height: auto; }
.graph-edges line { stroke: #bdb9b5; stroke-width: 1; stroke-dasharray: 4 4; }
.graph-edge-label { fill: #7b7672; font: 10px "Geist", ui-sans-serif, sans-serif; letter-spacing: .02em; text-anchor: middle; paint-order: stroke; stroke: #fbfaf8; stroke-width: 4px; }
.graph-node rect { fill: #fff; stroke: #cfccc8; stroke-width: 1; }
.graph-node text, .graph-center text { fill: #201e1d; font: 600 12px "Geist", ui-sans-serif, sans-serif; text-anchor: middle; }
.graph-node .graph-node-sub { fill: #6b6865; font-size: 11px; font-weight: 450; }
.graph-center rect { fill: #1b1918; stroke: #1b1918; }
.graph-center text { fill: #dfff68; font-size: 13px; }
.graph-center .graph-node-sub { fill: #c2beba; font-size: 11px; font-weight: 450; }

.app-layer-data-view { display: none; height: 100%; }
.app-layer-data-view.active { display: block; }
.app-layer-code { height: 100%; margin: 0; padding: 26px 30px 48px; background: #1b1918; color: #dedbd7; overflow: auto; font: 12px/1.65 "SFMono-Regular", Consolas, "Liberation Mono", monospace; tab-size: 2; }
.app-layer-code .json-key { color: #a9ccff; }
.app-layer-code .json-string { color: #dfff68; }
.app-layer-code .json-number { color: #ffbc7c; }
.app-layer-code .json-boolean, .app-layer-code .json-null { color: #ccb9ff; }

.app-layer-tree-wrap { position: relative; height: 100%; min-height: 420px; background-color: #f2f1ef; background-image: radial-gradient(#d4d1cd 1px, transparent 1px); background-size: 20px 20px; overflow: auto; }
.app-layer-tree-tools { position: sticky; z-index: 3; top: 14px; float: right; display: flex; margin: 14px; padding: 4px; border: 1px solid #d9d6d2; border-radius: 11px; background: rgba(255,255,255,.93); box-shadow: 0 8px 24px rgba(32,30,29,.1); gap: 2px; backdrop-filter: blur(10px); }
.app-layer-tree-tools button { display: grid; width: 32px; height: 32px; border: 0; border-radius: 8px; background: transparent; color: #514d4a; cursor: pointer; place-items: center; }
.app-layer-tree-tools button:hover { background: #efedea; }
.app-layer-tree-tools svg { width: 14px; height: 14px; }
.app-layer-tree-stage { width: max-content; min-width: 100%; padding: 42px 74px 90px 42px; transform: scale(var(--tree-scale, 1)); transform-origin: top left; transition: transform .15s ease; }

.json-tree, .json-tree ul { margin: 0; padding: 0; list-style: none; }
.json-tree ul { position: relative; margin-left: 25px; padding: 10px 0 2px 26px; border-left: 1px solid #bfc5c9; }
.json-tree li { position: relative; margin: 8px 0; }
.json-tree ul > li::before { position: absolute; top: 20px; left: -26px; width: 25px; height: 1px; background: #bfc5c9; content: ""; }
.json-tree details > summary { list-style: none; cursor: pointer; }
.json-tree details > summary::-webkit-details-marker { display: none; }
.json-node {
  display: inline-flex;
  min-width: 210px;
  max-width: 390px;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid #d5d2ce;
  border-left: 4px solid var(--node-color, #8f8a86);
  border-radius: 8px;
  background: rgba(255,255,255,.97);
  box-shadow: 0 5px 16px rgba(32,30,29,.07);
  align-items: center;
  gap: 10px;
  vertical-align: top;
}
.json-node-key { color: #272422; font-size: 12px; font-weight: 650; }
.json-node-preview { max-width: 190px; color: #7b7672; font: 10px/1.3 "SFMono-Regular", Consolas, monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.json-node-type { margin-left: auto; padding: 3px 6px; border-radius: 999px; background: color-mix(in srgb, var(--node-color) 13%, white); color: #5e5955; font-size: 9px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.json-node.object { --node-color: #8876d9; }
.json-node.array { --node-color: #6d9ddb; }
.json-node.string { --node-color: #75a96e; }
.json-node.number { --node-color: #d79754; }
.json-node.boolean { --node-color: #bc72a5; }
.json-node.null { --node-color: #96918c; }
.json-tree details[open] > summary .json-node { border-color: color-mix(in srgb, var(--node-color) 45%, #d5d2ce); }

.app-layer-empty { display: grid; min-height: 300px; color: #77726f; place-items: center; }

@media (max-width: 1080px) {
  .app-layer-panel { grid-template-columns: 240px minmax(0, 1fr); }
  .app-layer-glossary { grid-template-columns: 1fr; }
}

@media (max-width: 920px) {
  .app-layer-dock { top: 10px; max-width: calc(100vw - 24px); overflow-x: auto; }
  .app-layer-tab { padding-inline: 12px; }
  .app-layer-panel { padding-left: 76px; grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .context-nav { padding: 70px 18px 12px; border-right: 0; border-bottom: 1px solid #dedbd7; gap: 6px; }
  .context-nav-title { font-size: 20px; }
  .context-nav-definition { display: none; }
  .context-nav-list { display: flex; padding-top: 10px; gap: 6px; overflow-x: auto; }
  .context-nav-group { display: contents; }
  .context-nav-item { width: auto; flex: none; }
  .context-nav-sub { display: none; }
  .source-switch { display: flex; }
  .app-layer-panel-header { padding: 20px 24px 14px; }
  .app-layer-subbar { padding-inline: 24px; }
  .app-layer-section, .app-layer-glossary { padding: 20px 24px 40px; }
  .source-json.with-card { grid-template-columns: 1fr; }
  .source-product-card { display: grid; grid-template-columns: 110px 1fr; }
  .source-product-card img, .source-product-placeholder { height: 140px; }
}

@media (max-width: 760px) {
  .app-layer-panel { padding-left: 0; padding-bottom: 70px; }
}

@media (max-width: 620px) {
  .app-layer-dock { left: 12px; right: 12px; width: auto; transform: none; }
  .app-layer-tab { min-width: max-content; padding-inline: 11px; }
  .app-layer-subbar { padding-inline: 18px; align-items: flex-start; flex-direction: column; }
  .app-layer-section, .app-layer-glossary { padding: 16px 16px 32px; }
  .source-detail-head { flex-direction: column; }
  .source-detail-meta { justify-content: flex-start; }
  .source-view-body { padding: 14px; }
  .app-layer-title { font-size: 25px; }
  .app-layer-tree-stage { padding: 36px 42px 70px 24px; }
}
