/* AAT Studio admin. A research instrument, not a SaaS dashboard:
   paper and ink, one accent, hairline rules, serif headings, mono data. */
@import url('/vendor/fonts/fonts.css');

:root {
  --paper: #f3f1ec; --paper-2: #ebe8e1; --panel: #fbfaf7; --sunk: #efece5;
  --ink: #191917; --ink-2: #45433e; --muted: #807c73; --faint: #a7a397;
  --rule: #dcd8ce; --rule-2: #c7c2b5;
  --accent: #a3341f; --accent-ink: #7f2615; --accent-wash: #f4e4df;
  --ok: #2c6a4d; --ok-wash: #e3eee7; --warn: #8f6510; --warn-wash: #f4ecd9; --bad: #a3341f; --bad-wash: #f4e4df;
  --serif: 'Source Serif 4', 'Iowan Old Style', Charter, Georgia, serif;
  --sans: 'IBM Plex Sans', -apple-system, 'Helvetica Neue', Arial, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, Menlo, monospace;
  --r: 3px;
  font-family: var(--sans); font-size: 14px; color: var(--ink);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--paper); }
body { -webkit-font-smoothing: antialiased; line-height: 1.5; font-feature-settings: 'tnum' 1; }
::selection { background: #e9d9b7; }
a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--rule-2); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--ink); }
h1 { font-family: var(--serif); font-weight: 600; font-size: 30px; line-height: 1.15; letter-spacing: -.01em; margin: 0; }
h2 { font-family: var(--serif); font-weight: 600; font-size: 18px; margin: 0 0 2px; letter-spacing: -.003em; }
h3 { font-family: var(--mono); font-weight: 500; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 18px 0 10px; }
p { margin: 0 0 10px; color: var(--ink-2); }
.muted { color: var(--muted); } .small { font-size: 12.5px; } .mono { font-family: var(--mono); font-size: 12px; }
hr { border: 0; border-top: 1px solid var(--rule); margin: 20px 0; }
code { font-family: var(--mono); font-size: 12px; background: var(--sunk); padding: 1px 5px; border-radius: 2px; }
.ic { width: 15px; height: 15px; flex: none; vertical-align: -2px; stroke-width: 1.6; }
h2 .ic { display: none; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.shell.collapsed { grid-template-columns: 0 1fr; }
.shell.collapsed .side { visibility: hidden; }
.side { background: var(--paper-2); border-right: 1px solid var(--rule); padding: 22px 0 14px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { padding: 0 20px 22px; border-bottom: 1px solid var(--rule); margin-bottom: 10px; }
.brand .logo { display: none; }
.brand > div { font-family: var(--serif); font-weight: 600; font-size: 21px; letter-spacing: -.01em; line-height: 1.1; }
.brand small { display: block; font-family: var(--mono); font-weight: 400; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-top: 6px; }
.nav-sec { font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); padding: 16px 20px 6px; }
.nav { display: flex; flex-direction: column; }
.nav a, .nav button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 20px; color: var(--ink-2); font: inherit; background: none; border: 0; border-left: 2px solid transparent; cursor: pointer; text-align: left; text-decoration: none; }
.nav a:hover, .nav button:hover { color: var(--ink); background: rgba(0,0,0,.025); }
.nav a.on { color: var(--ink); font-weight: 600; border-left-color: var(--ink); background: rgba(0,0,0,.03); }
.nav .count { margin-left: auto; font-family: var(--mono); font-size: 11.5px; color: var(--muted); font-weight: 400; }
.nav .sub { padding-left: 45px; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; color: var(--muted); }
.nav .sub.on { color: var(--ink); }
.nav svg { width: 15px; height: 15px; flex: none; opacity: .7; stroke-width: 1.6; }
#newStudy { color: var(--accent); font-weight: 600; }
#newStudy svg { opacity: 1; }
.side .spacer { flex: 1; }
.side .me { display: flex; align-items: center; gap: 10px; padding: 14px 20px 0; border-top: 1px solid var(--rule); margin-top: 10px; font-size: 13px; }
.avatar { width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--rule-2); color: var(--ink-2); display: grid; place-items: center; font-family: var(--mono); font-size: 11px; flex: none; background: var(--panel); }
.main { min-width: 0; }
.topbar { height: 52px; display: flex; align-items: center; gap: 12px; padding: 0 32px; border-bottom: 1px solid var(--rule); background: var(--paper); position: sticky; top: 0; z-index: 20; }
.topbar .crumbs { display: flex; gap: 8px; align-items: center; color: var(--muted); min-width: 0; font-size: 13px; }
.topbar .crumbs a { color: var(--muted); text-decoration: none; }
.topbar .crumbs a:hover { color: var(--ink); }
.topbar .crumbs b { color: var(--ink); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.content { padding: 34px 32px 60px; max-width: 1320px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 26px; flex-wrap: wrap; }
.page-head .grow { flex: 1; min-width: 260px; }
.page-head p.muted { font-family: var(--mono); font-size: 12px; margin-top: 8px !important; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 32px; padding: 0 13px; border-radius: var(--r); border: 1px solid var(--rule-2); background: var(--panel); color: var(--ink); font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap; text-decoration: none; transition: background .1s, border-color .1s; }
.btn:hover { border-color: var(--ink-2); background: #fff; }
.btn:active { background: var(--sunk); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn.primary:hover { background: #000; }
.btn.danger { color: var(--bad); }
.btn.danger.solid { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--sunk); border-color: transparent; }
.btn.sm { height: 27px; padding: 0 9px; font-size: 12.5px; }
.btn.icon { width: 32px; padding: 0; }
.btn svg { width: 14px; height: 14px; stroke-width: 1.7; }
.btn.ai { color: var(--ink); border-color: var(--rule-2); background: var(--panel); }
.btn.ai svg { display: none; }
.btn.ai::before { content: '›'; font-family: var(--mono); color: var(--accent); font-weight: 500; }
.field { margin-bottom: 16px; }
.field > label, .lbl { display: block; font-family: var(--mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; font-weight: 400; }
.field .hint { font-size: 12.5px; color: var(--muted); margin-top: 6px; line-height: 1.45; }
.field .ferr { font-size: 12.5px; color: var(--bad); margin-top: 6px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], input:not([type]), select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--rule-2); border-radius: var(--r); padding: 7px 10px; outline: none; min-height: 33px; transition: border-color .1s; }
textarea { resize: vertical; min-height: 80px; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.has-err input, .has-err select, .has-err textarea { border-color: var(--bad); }
input[type=range] { width: 100%; accent-color: var(--ink); }
input[type=color] { width: 40px; height: 33px; border: 1px solid var(--rule-2); border-radius: var(--r); padding: 2px; background: var(--panel); cursor: pointer; }
input[type=checkbox] { accent-color: var(--ink); width: 14px; height: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.inline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid var(--rule-2); border-radius: var(--r); overflow: hidden; background: var(--panel); }
.seg button { border: 0; border-right: 1px solid var(--rule); background: transparent; font: inherit; font-size: 13px; color: var(--ink-2); padding: 6px 13px; cursor: pointer; }
.seg button:last-child { border-right: 0; }
.seg button:hover { background: var(--sunk); }
.seg button.on { background: var(--ink); color: var(--paper); }
.toggle { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; color: var(--ink-2); }
.toggle input { appearance: none; width: 30px; height: 16px; border-radius: 99px; background: var(--rule-2); position: relative; cursor: pointer; margin: 0; transition: background .12s; flex: none; }
.toggle input::after { content: ''; position: absolute; width: 12px; height: 12px; border-radius: 50%; background: var(--panel); top: 2px; left: 2px; transition: transform .12s; }
.toggle input:checked { background: var(--ink); }
.toggle input:checked::after { transform: translateX(14px); }
.rangeval { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 11.5px; color: var(--faint); margin-top: 3px; }
.rangeval b { color: var(--ink); font-weight: 500; }

/* ---------- surfaces ---------- */
.panel { background: var(--panel); border: 1px solid var(--rule); border-radius: var(--r); }
.panel.pad { padding: 20px; }
.panel-head { display: flex; align-items: baseline; gap: 12px; padding: 15px 20px 13px; border-bottom: 1px solid var(--rule); }
.panel-head .grow { flex: 1; }
.panel-head .small.muted { font-size: 12.5px; }
.panel-body { padding: 20px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 20px; padding: 0 7px; border-radius: 2px; font-family: var(--mono); font-size: 10.5px; letter-spacing: .04em; text-transform: uppercase; border: 1px solid var(--rule-2); color: var(--ink-2); background: transparent; white-space: nowrap; }
.chip.ok { color: var(--ok); border-color: #b9d3c4; background: var(--ok-wash); }
.chip.warn { color: var(--warn); border-color: #e2cf9f; background: var(--warn-wash); }
.chip.bad { color: var(--bad); border-color: #e0b6ab; background: var(--bad-wash); }
.chip.accent { color: var(--ink); border-color: var(--ink-2); }
.chip.ai { color: var(--ink-2); border-style: dashed; }
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tabs { display: flex; gap: 26px; border-bottom: 1px solid var(--rule); margin-bottom: 26px; overflow-x: auto; }
.tabs a { padding: 10px 0; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; text-decoration: none; font-size: 13.5px; }
.tabs a:hover { color: var(--ink); }
.tabs a.on { color: var(--ink); border-bottom-color: var(--ink); font-weight: 500; }
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty h2 { color: var(--ink); }
.notice { display: flex; gap: 10px; padding: 11px 14px; border-radius: var(--r); font-size: 13px; line-height: 1.5; margin-bottom: 12px; border: 1px solid; border-left-width: 3px; }
.notice.bad { background: var(--bad-wash); border-color: #e0b6ab; border-left-color: var(--bad); color: #6d2213; }
.notice.warn { background: var(--warn-wash); border-color: #e2cf9f; border-left-color: var(--warn); color: #5e430b; }
.notice.ok { background: var(--ok-wash); border-color: #b9d3c4; border-left-color: var(--ok); color: #1e4b36; }
.notice.info { background: var(--panel); border-color: var(--rule); border-left-color: var(--ink); color: var(--ink-2); }
.notice ul { margin: 4px 0 0; padding-left: 18px; }
.notice a { color: inherit; cursor: pointer; }
.defs { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--rule); border-radius: var(--r); margin-bottom: 18px; }
.defs > div { padding: 12px 14px; font-size: 13px; color: var(--ink-2); line-height: 1.5; }
.defs > div + div { border-left: 1px solid var(--rule); }
.defk { display: block; font-family: var(--mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink); margin-bottom: 4px; }

/* ---------- dashboard ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.scard { background: var(--panel); border: 1px solid var(--rule); border-radius: var(--r); overflow: hidden; display: flex; flex-direction: column; color: inherit; text-decoration: none; transition: border-color .12s; }
.scard:hover { border-color: var(--ink-2); }
.scard .cover { height: 150px; background-size: cover; background-position: center; position: relative; border-bottom: 1px solid var(--rule); display: grid; place-items: center; }
.scard .cover img.render { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scard .cover .word { font-family: var(--serif); color: #fff; font-size: 22px; }
.scard .cover .chip { position: absolute; top: 10px; left: 10px; background: var(--panel); z-index: 1; }
.scard .cover .chip + .chip { left: auto; right: 10px; }
.scard .body { padding: 14px 16px 15px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.scard .title { font-family: var(--serif); font-weight: 600; font-size: 17px; line-height: 1.25; }
.scard .body > .small.muted { font-family: var(--mono); font-size: 11.5px; }
.scard .stats { display: flex; gap: 16px; color: var(--muted); padding-top: 10px; border-top: 1px solid var(--rule); margin-top: 10px; font-family: var(--mono); font-size: 11.5px; }
.scard .stats b { color: var(--ink); font-weight: 500; }
.scard.new { border-style: dashed; background: transparent; align-items: center; justify-content: center; min-height: 250px; color: var(--muted); gap: 8px; cursor: pointer; font-family: var(--serif); font-size: 17px; }
.scard.new:hover { color: var(--ink); border-color: var(--ink-2); }
.scard.new .plus { font-family: var(--mono); font-size: 28px; line-height: 1; }

/* ---------- stats ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); border: 1px solid var(--rule); border-radius: var(--r); background: var(--panel); margin-bottom: 20px; overflow: hidden; }
.tile { padding: 16px 18px; border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); margin: 0 -1px -1px 0; }
.tile .k { font-family: var(--mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.tile .v { font-family: var(--serif); font-size: 32px; font-weight: 500; letter-spacing: -.01em; margin-top: 6px; line-height: 1.1; }
.tile .s { font-family: var(--mono); font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.chart { width: 100%; height: auto; display: block; }
.chart text { font-size: 11px; fill: var(--muted); font-family: var(--mono); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th { text-align: left; font-family: var(--mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 400; padding: 9px 12px; border-bottom: 1px solid var(--rule-2); background: var(--panel); position: sticky; top: 0; white-space: nowrap; }
table.t td { padding: 9px 12px; border-bottom: 1px solid var(--rule); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: #f6f4ef; }
table.t td.num, table.t th.num { text-align: right; font-family: var(--mono); font-size: 12.5px; }
table.t td b { font-weight: 500; }

/* ---------- builder ---------- */
.builder { display: grid; grid-template-columns: 170px minmax(0, 1fr) 380px; gap: 28px; align-items: start; }
.spy { position: sticky; top: 76px; display: flex; flex-direction: column; counter-reset: sec; }
.spy a { padding: 5px 0 5px 12px; color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 8px; border-left: 1px solid var(--rule); text-decoration: none; counter-increment: sec; }
.spy a::before { content: counter(sec, decimal-leading-zero); font-family: var(--mono); font-size: 10.5px; color: var(--faint); width: 18px; }
.spy a:hover { color: var(--ink); }
.spy a.on { color: var(--ink); border-left: 2px solid var(--ink); padding-left: 11px; font-weight: 500; }
.spy a .errdot { width: 6px; height: 6px; border-radius: 50%; background: var(--bad); margin-left: auto; }
.sec { scroll-margin-top: 76px; margin-bottom: 20px; }
.sec .panel-head { align-items: center; }
.sec .panel-head h2 { margin: 0; font-size: 19px; }
.sec .panel-head .n { font-family: var(--mono); font-size: 11px; color: var(--faint); letter-spacing: .04em; }
.sec .panel-head .n::before { content: '§ '; }
.side-preview { position: sticky; top: 76px; display: flex; flex-direction: column; gap: 16px; }
.zstage { position: relative; aspect-ratio: 16 / 10; border-radius: 2px; overflow: hidden; background: #1a1a18; }
.zstage .zscene { position: absolute; inset: 0; transform-origin: 50% 50%; }
.zstage .zbg { position: absolute; inset: 0; background-size: cover; background-position: center; }
.zstage .zstim { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); font-weight: 700; white-space: nowrap; text-align: center; transform-origin: 50% 50%; }
.zstage .zstim img { height: 34%; display: block; }
.zstage .zlabel { position: absolute; left: 0; bottom: 0; font-family: var(--mono); font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: #f3f1ec; background: rgba(25,25,23,.72); padding: 4px 8px; }
.blocks-list { display: flex; flex-direction: column; border: 1px solid var(--rule); border-radius: var(--r); }
.brow { display: grid; grid-template-columns: 26px 1.2fr 1fr 1.2fr 80px 1fr 30px; gap: 8px; align-items: center; padding: 7px 8px; border-bottom: 1px solid var(--rule); background: var(--panel); }
.blocks-list .brow:last-child { border-bottom: 0; }
#demos .brow { border: 1px solid var(--rule); border-radius: var(--r); }
.brow .idx { font-family: var(--mono); color: var(--faint); text-align: center; font-size: 11.5px; }
.brow input, .brow select { min-height: 29px; padding: 4px 8px; font-size: 13px; }
.bhead { display: grid; grid-template-columns: 26px 1.2fr 1fr 1.2fr 80px 1fr 30px; gap: 8px; padding: 0 8px 6px; font-family: var(--mono); font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; }
.items-table { max-height: 420px; overflow: auto; border: 1px solid var(--rule); border-radius: var(--r); }
.items-table table.t td { padding: 5px 10px; }
.items-table select, .items-table input { min-height: 28px; padding: 3px 7px; font-size: 13px; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.thumb { border: 1px solid var(--rule); border-radius: var(--r); overflow: hidden; background: var(--panel); display: flex; flex-direction: column; }
.thumb .img { aspect-ratio: 4/3; background: var(--sunk) center/contain no-repeat; position: relative; border-bottom: 1px solid var(--rule); }
.thumb .img .x { position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; border-radius: 2px; border: 1px solid var(--rule-2); background: var(--panel); cursor: pointer; font-size: 13px; line-height: 1; }
.thumb .meta { padding: 8px; display: flex; flex-direction: column; gap: 6px; font-size: 12px; }
.thumb .meta select, .thumb .meta input { min-height: 27px; padding: 3px 7px; font-size: 12.5px; }
.thumb .flags { display: flex; gap: 4px; flex-wrap: wrap; }
.drop { border: 1px dashed var(--rule-2); border-radius: var(--r); padding: 26px; text-align: center; color: var(--muted); cursor: pointer; background: var(--panel); }
.drop:hover, .drop.over { border-color: var(--ink); color: var(--ink); background: #fff; }
.keycap { display: inline-grid; place-items: center; min-width: 26px; height: 24px; padding: 0 6px; border: 1px solid var(--rule-2); border-bottom-width: 2px; border-radius: 3px; background: var(--panel); font-family: var(--mono); font-size: 12px; font-weight: 500; }
.keypick { display: flex; align-items: center; gap: 8px; }
.keypick button.listening { border-color: var(--accent); color: var(--accent); }
.envtiles { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0; border: 1px solid var(--rule-2); border-radius: var(--r); overflow: hidden; }
.envtile { border: 0; border-right: 1px solid var(--rule); background: var(--panel); padding: 0 0 10px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; font: inherit; color: var(--ink-2); text-align: center; }
.envtile:last-child { border-right: 0; }
.envtile:hover { background: #fff; }
.envtile.on { background: var(--ink); color: var(--paper); }
.envtile.on .small { color: #c9c4b7; }
.envtile b { font-size: 12.5px; font-weight: 500; padding: 8px 6px 0; }
.envtile .small { font-size: 11px; font-family: var(--mono); }
.envsw { display: block; width: 100%; height: 46px; }
.env-street { background: linear-gradient(180deg,#a9c3dd 0 45%,#b9ab97 45% 60%,#55575c 60%); }
.env-park { background: linear-gradient(180deg,#a9c3dd 0 45%,#4f7a43 45% 62%,#6c955a 62%); }
.env-corridor { background: linear-gradient(90deg,#cfc9bd 0 22%,transparent 22% 78%,#cfc9bd 78%), linear-gradient(180deg,#f0eee8 0 30%,#e2ddd2 30% 66%,#d2cec5 66%); }
.env-room { background: linear-gradient(180deg,#ebe8e1 0 62%,#9a6f4b 62%); }
.env-studio { background: linear-gradient(180deg,#cfd2d6 0 55%,#a2a7ae 55%); }
.objtiles { display: grid; grid-template-columns: repeat(5, 1fr); border: 1px solid var(--rule-2); border-radius: var(--r); overflow: hidden; }
.objtile { position: relative; border: 0; border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); background: var(--panel); padding: 8px 6px 10px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px; font: inherit; font-size: 12.5px; color: var(--ink-2); }
.objtile:nth-child(5n) { border-right: 0; }
.objtile:nth-last-child(-n+5) { border-bottom: 0; }
.objtile:hover { background: #fff; color: var(--ink); }
.objtile img { width: 100%; height: 74px; object-fit: contain; }
.objtile i { position: absolute; top: 6px; right: 6px; font-style: normal; font-family: var(--mono); font-size: 9.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--ok); }
.objtile.on { background: var(--ok-wash); }

/* ---------- assistant ---------- */
.aibar { display: flex; gap: 0; align-items: stretch; border: 1px solid var(--rule-2); border-radius: var(--r); background: var(--panel); margin-bottom: 22px; overflow: hidden; }
.aibar .spark { display: flex; align-items: center; padding: 0 12px; font-family: var(--mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--paper); background: var(--ink); white-space: nowrap; }
.aibar .spark svg { display: none; }
.aibar .spark::after { content: 'Assistant'; }
.aibar input { border: 0; background: transparent; box-shadow: none !important; padding: 9px 12px; font-family: var(--mono); font-size: 13px; }
.aibar input::placeholder { color: var(--faint); }
.aibar .btn { border: 0; border-left: 1px solid var(--rule); border-radius: 0; height: auto; }
.diff { border: 1px solid var(--rule); border-radius: var(--r); overflow: hidden; max-height: 46vh; overflow-y: auto; }
.diff .d { display: grid; grid-template-columns: 1.1fr 1fr 1fr; gap: 10px; padding: 7px 12px; border-bottom: 1px solid var(--rule); font-size: 12.5px; align-items: start; }
.diff .d:last-child { border-bottom: 0; }
.diff .d .p { font-family: var(--mono); color: var(--ink-2); word-break: break-all; font-size: 11.5px; }
.diff .d .b { color: var(--bad); text-decoration: line-through; word-break: break-word; font-family: var(--mono); font-size: 12px; }
.diff .d .a { color: var(--ok); word-break: break-word; font-family: var(--mono); font-size: 12px; }
.thinking { display: inline-flex; gap: 4px; margin-right: 8px; }
.thinking i { width: 5px; height: 5px; background: var(--ink); animation: blink 1.1s infinite; }
.thinking i:nth-child(2) { animation-delay: .18s; } .thinking i:nth-child(3) { animation-delay: .36s; }
@keyframes blink { 0%, 80%, 100% { opacity: .15; } 40% { opacity: 1; } }
.working { display: flex; align-items: center; justify-content: center; padding: 22px 0; font-family: var(--mono); font-size: 12.5px; color: var(--ink); }

/* ---------- modal / toast / drawer ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(25,25,23,.32); z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 8vh 20px 20px; overflow-y: auto; animation: fade .12s; }
.modal { background: var(--panel); border: 1px solid var(--rule-2); border-radius: var(--r); width: min(640px, 100%); box-shadow: 0 24px 60px rgba(25,25,23,.18); }
.modal.wide { width: min(940px, 100%); }
.modal-head { padding: 18px 22px 0; display: flex; align-items: flex-start; gap: 10px; }
.modal-head h2 { font-size: 21px; }
.modal-head .grow { flex: 1; }
.modal-body { padding: 16px 22px; }
.modal-foot { padding: 12px 22px; border-top: 1px solid var(--rule); display: flex; justify-content: flex-end; gap: 8px; align-items: center; background: var(--paper); }
@keyframes fade { from { opacity: 0; } }
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: var(--ink); color: var(--paper); padding: 9px 14px; border-radius: var(--r); font-family: var(--mono); font-size: 12.5px; max-width: 560px; animation: fade .15s; }
.toast.bad { background: var(--bad); }
.drawer-bg { position: fixed; inset: 0; background: rgba(25,25,23,.2); z-index: 90; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(780px, 96vw); background: var(--panel); border-left: 1px solid var(--rule-2); z-index: 91; display: flex; flex-direction: column; animation: fade .12s; }
.drawer .dh { padding: 18px 22px; border-bottom: 1px solid var(--rule); display: flex; gap: 10px; align-items: center; }
.drawer .db { padding: 20px 22px; overflow: auto; flex: 1; }
.kv { display: grid; grid-template-columns: 170px 1fr; gap: 8px 16px; font-size: 13px; margin: 0; }
.kv dt { font-family: var(--mono); font-size: 11px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding-top: 2px; }
.kv dd { margin: 0; word-break: break-word; }
.menu { position: absolute; background: var(--panel); border: 1px solid var(--rule-2); border-radius: var(--r); padding: 4px; z-index: 60; min-width: 200px; box-shadow: 0 12px 30px rgba(25,25,23,.12); }
.menu button { display: flex; width: 100%; gap: 8px; align-items: center; padding: 7px 10px; border: 0; background: none; border-radius: 2px; font: inherit; font-size: 13px; cursor: pointer; text-align: left; color: var(--ink); }
.menu button:hover { background: var(--sunk); }
.menu button.danger { color: var(--bad); }
.menu svg { width: 14px; height: 14px; }
.copy { display: flex; gap: 8px; }
.copy input { font-family: var(--mono); font-size: 12px; background: var(--sunk); }
.saving { font-family: var(--mono); font-size: 11.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 7px; }
.saving .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }
.saving.dirty .dot { background: var(--warn); }
.saving.err .dot { background: var(--bad); }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.15fr 1fr; background: var(--paper); }
.login .art { border-right: 1px solid var(--rule); padding: 48px 56px; display: flex; flex-direction: column; justify-content: space-between; gap: 30px; background: var(--paper-2); }
.login .art .brand { padding: 0; border: 0; margin: 0; }
.login .art h1 { font-size: 40px; max-width: 520px; line-height: 1.12; }
.login .art p { max-width: 470px; font-size: 15px; }
.login .art .colophon { font-family: var(--mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.login form { align-self: center; justify-self: center; width: min(360px, 88%); }
.login form h1 { font-size: 28px; }
.login .figure { margin: 0; border-top: 1px solid var(--rule-2); border-bottom: 1px solid var(--rule-2); padding: 18px 0; }
.login .figure svg { width: 100%; max-width: 540px; height: auto; display: block; }
.login .figure figcaption { font-family: var(--mono); font-size: 11px; color: var(--muted); margin-top: 10px; letter-spacing: .03em; }

@media (max-width: 1200px) { .builder { grid-template-columns: 150px minmax(0, 1fr); } .side-preview { display: none; } }
@media (max-width: 860px) { .shell { grid-template-columns: 1fr; } .side { display: none; } .builder { grid-template-columns: 1fr; } .spy { display: none; } .login { grid-template-columns: 1fr; } .login .art { display: none; } .grid2, .grid3, .defs { grid-template-columns: 1fr; } .content { padding: 20px; } .envtiles, .objtiles { grid-template-columns: repeat(2, 1fr); } }
