/* GENUBRA AI app: the same calm system as the front page. Paper + ink, one magenta signal for the line. */
:root {
  --paper: #fbfbf9; --paper-2: #f3f3f0; --card: #ffffff; --ink: #0b0b0f; --ink-2: #4a4b53; --ink-3: #7b7c85;
  --rule: #e6e6e1; --rule-2: #d6d6d0; --sig: #d1155c; --sig-soft: #fbe6ee; --ok: #128a4c; --bad: #c62d2d;
  --sans: "Schibsted Grotesk", "Segoe UI", system-ui, sans-serif; --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --side: 272px; --ease: cubic-bezier(.16, 1, .3, 1); color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --paper: #0b0b0e; --paper-2: #131318; --card: #16161c; --ink: #f2f2f4; --ink-2: #b2b3bc; --ink-3: #85868f; --rule: #24242c; --rule-2: #33333d; --sig: #ff4d8b; --sig-soft: #2a1019; --ok: #3ccf82; --bad: #ff6b6b; color-scheme: dark; }
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--paper); color: var(--ink); font: 400 15.5px/1.55 var(--sans); -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--sig); outline-offset: 2px; border-radius: 8px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
h1, h2, h3 { margin: 0; letter-spacing: -0.03em; line-height: 1.05; }
p { margin: 0; }

.mark { width: 30px; height: 18px; flex: none; }
.mark rect { fill: var(--sig); }
.mark circle { fill: var(--paper); stroke: var(--ink); stroke-width: 3.4; }
.boot { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 14px; color: var(--ink-3); }
.boot .mark { width: 56px; height: 34px; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--rule-2); background: var(--card); font-weight: 600; font-size: 14.5px; text-decoration: none; transition: background .15s, border-color .15s, transform .15s var(--ease); white-space: nowrap; }
.btn:hover { border-color: var(--ink-3); }
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .5; cursor: default; }
.btn-ink { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn-ink:hover { border-color: var(--ink); opacity: .9; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--paper-2); border-color: transparent; }
.btn-sm { min-height: 32px; padding: 0 12px; font-size: 13.5px; }
.btn-danger { color: var(--bad); }

/* auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(60% 50% at 50% 0%, var(--sig-soft), transparent 70%), var(--paper); }
.auth-card { width: min(420px, 100%); display: grid; gap: 18px; }
.auth-card .brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: .06em; font-size: 17px; text-decoration: none; }
.auth-card h1 { font-size: 40px; font-weight: 800; letter-spacing: -0.045em; }
.auth-card .sub { color: var(--ink-2); }
.seg { display: inline-flex; padding: 4px; gap: 4px; border-radius: 999px; background: var(--paper-2); border: 1px solid var(--rule); justify-self: start; }
.seg button { border: 0; background: transparent; padding: 8px 16px; border-radius: 999px; font-weight: 600; font-size: 14px; color: var(--ink-2); }
.seg button[aria-selected="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.field { display: grid; gap: 6px; }
.field label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.input { width: 100%; min-height: 46px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--rule-2); background: var(--card); font-size: 16px; }
.input:focus { outline: none; border-color: var(--sig); box-shadow: 0 0 0 3px var(--sig-soft); }
.note { font-size: 13.5px; color: var(--ink-3); }
.err { color: var(--bad); font-size: 14px; min-height: 1.3em; }

/* shell */
.shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); height: 100dvh; }
.shell.preview-on { grid-template-columns: var(--side) minmax(0, 1fr) minmax(0, 1.05fr); }
.side { display: flex; flex-direction: column; min-height: 0; background: var(--paper-2); border-right: 1px solid var(--rule); }
.side-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 14px 10px; }
.side .brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 800; letter-spacing: .06em; font-size: 15px; text-decoration: none; }
.side .brand .ai { font-weight: 500; color: var(--sig); margin-left: -4px; }
.new-chat { margin: 4px 12px 10px; justify-content: flex-start; }
.threads { flex: 1; overflow: auto; padding: 4px 8px; }
.threads .lbl { font: 500 11.5px/1 var(--mono); color: var(--ink-3); letter-spacing: .06em; text-transform: uppercase; padding: 12px 8px 6px; }
.thread { display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-radius: 10px; text-decoration: none; color: var(--ink-2); font-size: 14px; }
.thread span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); color: var(--ink); }
.thread.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.thread .del { opacity: 0; border: 0; background: none; color: var(--ink-3); padding: 2px 4px; border-radius: 6px; }
.thread:hover .del { opacity: 1; }
.side-nav { display: grid; gap: 2px; padding: 8px; border-top: 1px solid var(--rule); }
.side-nav a, .side-nav button { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; text-decoration: none; border: 0; background: none; color: var(--ink-2); font-size: 14px; text-align: left; }
.side-nav a:hover, .side-nav button:hover, .side-nav a.on { background: color-mix(in srgb, var(--ink) 6%, transparent); color: var(--ink); }
.me { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--rule); font-size: 13.5px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--ink); color: var(--paper); display: grid; place-items: center; font-weight: 700; flex: none; }
.me .who { flex: 1; min-width: 0; }
.me .who b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me .who span { color: var(--ink-3); font-size: 12.5px; }

/* main */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar { display: flex; align-items: center; gap: 10px; height: 56px; padding: 0 18px; border-bottom: 1px solid var(--rule); }
.topbar h2 { flex: 1; min-width: 0; font-size: 15.5px; font-weight: 600; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-btn { display: none; }
.model-pick { min-height: 34px; border-radius: 999px; border: 1px solid var(--rule-2); background: var(--card); padding: 0 30px 0 12px; font-size: 13.5px; font-weight: 600; appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%); background-position: calc(100% - 15px) 15px, calc(100% - 10px) 15px; background-size: 5px 5px; background-repeat: no-repeat; }
.scroll { flex: 1; overflow: auto; overscroll-behavior: contain; }
.col { width: min(780px, 100%); margin: 0 auto; padding: 28px 22px 40px; }

.empty { min-height: 100%; display: grid; place-content: center; padding: 32px 22px; }
.empty h1 { font-size: clamp(34px, 5vw, 54px); font-weight: 800; letter-spacing: -0.05em; text-align: center; }
.empty .sub { text-align: center; color: var(--ink-2); margin-top: 12px; }
.ideas { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 28px; width: min(680px, calc(100vw - 44px)); }
.idea { text-align: left; border: 1px solid var(--rule); background: var(--card); border-radius: 16px; padding: 14px 16px; display: grid; gap: 4px; transition: border-color .15s, transform .2s var(--ease); }
.idea:hover { border-color: var(--rule-2); transform: translateY(-1px); }
.idea b { font-size: 14.5px; }
.idea span { font-size: 13.5px; color: var(--ink-3); }

.msg { margin: 0 0 26px; }
.msg.user { display: flex; justify-content: flex-end; }
.msg.user .bubble { max-width: 82%; background: var(--paper-2); border: 1px solid var(--rule); border-radius: 20px 20px 6px 20px; padding: 11px 16px; white-space: pre-wrap; word-wrap: break-word; }
.who-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 12.5px; color: var(--ink-3); }
.model-chip { display: inline-flex; align-items: center; gap: 6px; font: 500 12px/1 var(--mono); color: var(--ink-2); background: var(--paper-2); border: 1px solid var(--rule); border-radius: 999px; padding: 5px 9px; }
.model-chip i { width: 7px; height: 7px; border-radius: 50%; background: var(--sig); }
.why { font-size: 12.5px; color: var(--ink-3); }
.md { word-wrap: break-word; }
.md > * + * { margin-top: .75em; }
.md h1, .md h2, .md h3 { font-size: 1.15em; margin-top: 1.2em; letter-spacing: -0.015em; }
.md ul, .md ol { padding-left: 1.3em; margin-bottom: 0; }
.md li + li { margin-top: .3em; }
.md a { color: var(--sig); }
.md code { font-family: var(--mono); font-size: .88em; background: var(--paper-2); border: 1px solid var(--rule); border-radius: 6px; padding: 1px 5px; }
.md pre { position: relative; background: #0f0f14; color: #e8e8ee; border-radius: 14px; padding: 14px 16px; overflow: auto; font: 13px/1.6 var(--mono); }
.md pre code { background: none; border: 0; padding: 0; color: inherit; font-size: inherit; }
.md pre .copy { position: absolute; top: 8px; right: 8px; font: 500 11.5px var(--mono); border: 1px solid #2c2c36; background: #1b1b22; color: #c9c9d2; border-radius: 8px; padding: 4px 8px; }
.md table { border-collapse: collapse; width: 100%; font-size: .95em; display: block; overflow: auto; }
.md th, .md td { border: 1px solid var(--rule); padding: 6px 10px; text-align: left; }
.md blockquote { margin: 0; padding-left: 14px; border-left: 3px solid var(--rule-2); color: var(--ink-2); }
.msg-actions { display: flex; gap: 4px; margin-top: 8px; opacity: .0; transition: opacity .15s; }
.msg:hover .msg-actions, .msg:focus-within .msg-actions { opacity: 1; }
.msg-actions button { border: 0; background: none; color: var(--ink-3); font-size: 12.5px; padding: 4px 8px; border-radius: 8px; }
.msg-actions button:hover { background: var(--paper-2); color: var(--ink); }
.msg.err .md { color: var(--bad); }

/* the line, while working */
.working { display: flex; align-items: center; gap: 12px; color: var(--ink-2); font-size: 14px; margin: 4px 0 10px; }
.wline { position: relative; width: 120px; height: 4px; border-radius: 2px; background: var(--rule); overflow: hidden; flex: none; }
.wline::after { content: ""; position: absolute; inset: 0; width: 40%; border-radius: 2px; background: var(--sig); animation: travel 1.4s var(--ease) infinite; }
@keyframes travel { from { transform: translateX(-100%); } to { transform: translateX(260%); } }
.stations { display: flex; gap: 6px; font: 500 11px/1 var(--mono); color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; }
.stations b { color: var(--sig); font-weight: 500; }

.artifact { margin-top: 12px; border: 1px solid var(--rule); background: var(--card); border-radius: 18px; padding: 14px 16px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.artifact .ic { width: 44px; height: 44px; border-radius: 12px; background: var(--sig-soft); display: grid; place-items: center; color: var(--sig); font-weight: 800; flex: none; }
.artifact .meta { flex: 1; min-width: 180px; }
.artifact .meta b { display: block; font-size: 15px; }
.artifact .meta span { font-size: 13px; color: var(--ink-3); }
.score { font: 600 12px/1 var(--mono); padding: 5px 8px; border-radius: 999px; background: var(--paper-2); }
.score.good { color: var(--ok); }
.gen-img { margin-top: 12px; border-radius: 16px; overflow: hidden; border: 1px solid var(--rule); max-width: 560px; }
.gen-img img { display: block; width: 100%; height: auto; }

/* composer */
.composer-wrap { padding: 10px 22px calc(14px + env(safe-area-inset-bottom)); }
.composer { width: min(780px, 100%); margin: 0 auto; border: 1px solid var(--rule-2); background: var(--card); border-radius: 22px; padding: 10px 10px 8px 16px; box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 16px 40px -28px rgba(0,0,0,.35); }
.composer:focus-within { border-color: color-mix(in srgb, var(--sig) 50%, var(--rule-2)); }
.composer textarea { width: 100%; resize: none; border: 0; background: transparent; outline: none; font-size: 16px; line-height: 1.5; max-height: 220px; min-height: 26px; padding: 4px 0; }
.comp-row { display: flex; align-items: center; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.modes { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.mode { border: 1px solid var(--rule); background: transparent; border-radius: 999px; padding: 5px 11px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.mode[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.send { width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--ink); color: var(--paper); display: grid; place-items: center; }
.send[disabled] { opacity: .35; }
.send svg { width: 18px; height: 18px; }
.comp-note { width: min(780px, 100%); margin: 8px auto 0; text-align: center; font-size: 12px; color: var(--ink-3); }

/* preview pane */
.preview { display: none; flex-direction: column; min-width: 0; border-left: 1px solid var(--rule); background: var(--paper-2); }
.preview-on .preview { display: flex; }
.pv-bar { display: flex; align-items: center; gap: 8px; height: 56px; padding: 0 12px; border-bottom: 1px solid var(--rule); background: var(--paper); }
.pv-bar b { flex: 1; min-width: 0; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pv-stage { flex: 1; display: grid; place-items: center; padding: 14px; min-height: 0; }
.pv-stage iframe { width: 100%; height: 100%; border: 1px solid var(--rule); border-radius: 14px; background: #fff; box-shadow: 0 20px 50px -30px rgba(0,0,0,.4); transition: width .3s var(--ease); }
.pv-stage.phone iframe { width: 390px; max-width: 100%; }

/* pages: memory, builds, admin */
.page { width: min(900px, 100%); margin: 0 auto; padding: 32px 22px 60px; display: grid; gap: 22px; }
.page h1 { font-size: 34px; font-weight: 800; letter-spacing: -0.04em; }
.page .lede { color: var(--ink-2); max-width: 62ch; }
.list { display: grid; gap: 8px; }
.row-item { display: flex; align-items: center; gap: 12px; border: 1px solid var(--rule); background: var(--card); border-radius: 14px; padding: 12px 14px; }
.row-item .grow { flex: 1; min-width: 0; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.card { border: 1px solid var(--rule); background: var(--card); border-radius: 16px; padding: 16px; display: grid; gap: 8px; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.stat { border: 1px solid var(--rule); background: var(--card); border-radius: 14px; padding: 14px; }
.stat b { display: block; font-size: 26px; font-weight: 800; letter-spacing: -0.03em; }
.stat span { font-size: 12.5px; color: var(--ink-3); }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th, table.t td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--rule); }
table.t th { font: 500 11.5px var(--mono); color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; }
.tw { overflow: auto; border: 1px solid var(--rule); border-radius: 14px; background: var(--card); }
code.k { font-family: var(--mono); font-size: 13px; background: var(--paper-2); border-radius: 6px; padding: 2px 6px; }
.ok { color: var(--ok); } .no { color: var(--bad); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 999px; font-size: 14px; z-index: 50; box-shadow: 0 12px 30px rgba(0,0,0,.3); }

@media (max-width: 900px) {
  .shell, .shell.preview-on { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); z-index: 40; transform: translateX(-102%); transition: transform .25s var(--ease); box-shadow: 0 0 60px rgba(0,0,0,.25); }
  .side.open { transform: none; }
  .menu-btn { display: inline-flex; }
  .preview-on .preview { position: fixed; inset: 0; z-index: 45; }
  .ideas { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

.close-side { display: none; }
@media (max-width: 900px) { .close-side { display: inline-flex; } }
