.model-section { grid-column:1/-1; min-width:0; margin-top:22px; padding-top:clamp(16px,1.5vw,26px); border-top:1px solid var(--border); }
.model-section h2 { font:600 clamp(30px,3vw,46px)/1.1 var(--pixel); letter-spacing:-.045em; }
.model-section header p { max-width:85ch; color:var(--body); line-height:1.6; margin:8px 0 20px; }
.model-board { color:var(--ink); border:1px solid #63546f; background:#1e1b2b; }
.board-bar, .map-caption { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:9px 16px; padding:9px clamp(10px,1.5vw,20px); background:#292536; }
.board-bar { border-bottom:1px solid #62546e; }
.board-bar > strong { font:600 21px/1.2 var(--pixel); }
.map-tools, .map-zoom { display:flex; align-items:center; gap:6px; flex-wrap:wrap; }
.map-tools button, .map-tools select { color:var(--ink); font:600 13px/1.2 "Segoe UI",sans-serif; border:1px solid #695d75; background:#373041; padding:7px 10px; min-height:34px; }
.map-tools select { width:clamp(135px,18vw,245px); }
.map-tools [data-fit] { background:#c0dcd3; color:#242536; border-color:#c0dcd3; }
.map-tools button:disabled { opacity:.45; cursor:default; }
.map-tools button:hover:not(:disabled), .card-grip:hover { border-color:var(--moon); }
.map-zoom { gap:0; flex-wrap:nowrap; background:#211e2f; }
.map-zoom button { font:20px/1 var(--mono); min-width:33px; padding:3px; }
.map-zoom output { min-width:44px; text-align:center; color:var(--aqua); font:12px var(--mono); }
.map-caption { font-size:12px; line-height:1.5; color:var(--quiet); border-top:1px solid var(--border); }
.map-legend, .map-legend > span { display:inline-flex; align-items:center; flex-wrap:wrap; gap:5px; }
.map-legend { gap:12px; }
.map-legend .field-icon { width:15px; height:15px; }
.join-sample { width:45px; height:17px; fill:none; stroke:var(--aqua); stroke-width:1.8; }
.map-viewport { position:relative; isolation:isolate; background-color:#1e1b2b; background-image:radial-gradient(#504558 1px,transparent 1px); background-size:17px 17px; }
.map-world { display:grid; align-items:start; grid-template-columns:repeat(auto-fit,minmax(min(100%,250px),1fr)); gap:18px; padding:16px; }
.map-lines, .card-grip, .map-tools, .pan-surface { display:none; }
.map-ready .map-tools { display:flex; }
.model-section:not(.map-ready) .map-hint { display:none; }
.map-ready .map-viewport { --available:calc(100dvh - var(--mast-height) - var(--dock-height) - var(--map-overhead,210px) - 22px); height:clamp(250px,var(--available),690px); overflow:clip; }
.map-ready .pan-surface { display:block; position:absolute; inset:0; touch-action:none; cursor:grab; }
.map-ready .map-world { position:absolute; inset:0 auto auto 0; display:block; width:0; height:0; padding:0; transform-origin:0 0; pointer-events:none; }
.map-ready .map-lines { display:block; position:absolute; width:1px; height:1px; overflow:visible; pointer-events:none; }
.map-lines path { stroke:#9a86a4; stroke-width:2; fill:none; }
.map-lines .one, .map-lines .many, .join-sample { stroke-linecap:round; stroke-linejoin:round; }
.map-lines .lit path { stroke:#bbdcd4; stroke-width:2.5; }
.schema-card { --card-accent:#c1a9d0; color:var(--ink); border:1px solid #76677e; border-top:3px solid var(--card-accent); background:#2b2537; box-shadow:3px 3px #141120; min-width:0; }
.schema-card[data-kind="Fact"] { --card-accent:#a5d1cb; }
.schema-card[data-kind="Measure host"] { --card-accent:#f0c894; }
.map-ready .schema-card { position:absolute; top:0; left:0; width:263px; pointer-events:auto; }
.schema-card.active { border-color:var(--card-accent); z-index:2; }
.schema-card summary { position:relative; display:grid; gap:5px; padding:11px 22px 10px 12px; list-style:none; cursor:pointer; }
.map-ready .schema-card summary { padding-left:33px; }
.schema-card summary::-webkit-details-marker { display:none; }
.schema-card summary::after { content:""; position:absolute; top:18px; right:12px; width:7px; height:7px; border:solid var(--card-accent); border-width:0 2px 2px 0; transform:rotate(45deg); }
.schema-card details[open] summary::after { transform:rotate(225deg); top:22px; }
.schema-card summary:focus-visible { outline-offset:-3px; }
.schema-card summary small { color:var(--card-accent); text-transform:uppercase; font:600 10px/1.1 var(--mono); letter-spacing:.09em; }
.schema-card summary strong { font:600 15px/1.3 var(--mono); overflow-wrap:anywhere; }
.card-counts { color:#d7cbd6; font:12px/1.3 "Segoe UI",sans-serif; }
.map-ready .card-grip { position:absolute; z-index:1; top:6px; left:2px; height:52px; width:27px; display:grid; place-items:center; padding:0; border:1px solid transparent; background:transparent; color:#b6a8bd; font:22px/1 var(--mono); cursor:grab; touch-action:none; }
.dragging, .dragging * { cursor:grabbing!important; user-select:none!important; }
.schema-fields { position:relative; border-top:1px solid #625667; padding:0 0 6px; background:#231f2f; scrollbar-color:#806f88 #292433; }
.map-ready .schema-fields { max-height:202px; overflow:auto; overscroll-behavior:contain; }
.schema-fields h4, .schema-fields h5 { margin:0; padding:8px 11px 4px; }
.schema-fields h4 { font:600 12px/1.2 "Segoe UI",sans-serif; color:var(--aqua); }
.schema-fields h5 { color:#dfbcc2; font:500 11px/1.2 var(--mono); }
.model-fields, .measure-fields { list-style:none; margin:0; padding:0; }
.model-fields li, .measure-fields li { display:flex; align-items:baseline; flex-wrap:wrap; gap:0 5px; padding:3px 11px; color:var(--ink); font:12px/1.5 var(--mono); overflow-wrap:anywhere; }
.model-fields li:nth-child(odd), .measure-fields li:nth-child(odd) { background:#2c2737; }
.field-name { margin-right:auto; }
.field-icon { display:inline-flex; align-items:center; align-self:center; flex:none; width:18px; height:18px; color:#c3b6cd; }
.field-icon svg { display:block; width:100%; height:100%; }
.icon-measure, .icon-key { color:var(--moon); }
.icon-foreign, .icon-date, .icon-aggregate { color:var(--aqua); }
.field-join { flex-basis:100%; padding-left:23px; color:#c3b2c8; font:10px/1.4 var(--mono); text-decoration:underline; text-underline-offset:2px; }
.field-join:hover { color:var(--moon); }
.measure-fields li { flex-wrap:nowrap; align-items:center; }
.measure-name { min-width:0; }
@media(max-width:680px) {
  .board-bar { align-items:start; }
  .map-tools { flex:1 1 100%; }
  .map-tools select { flex:1; min-width:82px; }
  .map-tools button, .map-tools select { min-height:36px; }
  .map-ready .map-viewport { height:clamp(230px,min(52svh,var(--available)),470px); }
  .map-caption { font-size:11px; }
}
