:root {
  --orange: #f47a1f;
  --orange-d: #e2640a;
  --orange-soft: #fff4ec;
  --orange-line: #fde3cf;
  --navy: #0f172a;
  --ink: #1e293b;
  --muted: #5b6577;
  --line: #e6e8ee;
  --bg: #ffffff;
  --panel: #fbfbfc;
  --ok: #15803d;
  --bad: #b42318;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 6px 20px rgba(15, 23, 42, .05);
  --sans: "IBM Plex Sans", ui-sans-serif, system-ui, "Segoe UI", sans-serif;
  --blue: #1d4ed8;
  --blue-d: #1738a0;
  --display: "Plus Jakarta Sans", "IBM Plex Sans", ui-sans-serif, system-ui, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  color: var(--ink);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); }
body { min-height: 100vh; display: flex; flex-direction: column; }
button { font: inherit; cursor: pointer; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* header */
.top { display: flex; align-items: center; justify-content: space-between; padding: 8px 18px; border-bottom: 1px solid #f0f1f4; position: sticky; top: 0; background: rgba(255,255,255,.96); backdrop-filter: blur(6px); z-index: 20; }
.brand-mini { font-weight: 800; font-size: 20px; text-decoration: none; letter-spacing: -.02em; visibility: hidden; }
body.chatting .brand-mini { visibility: visible; }
.brand-mini .o, .brand .o { color: var(--orange); }
.brand-mini .n, .brand .n { color: var(--navy); }
.actions { display: flex; gap: 6px; align-items: center; }
.btn { display: inline-flex; align-items: center; gap: 6px; height: 42px; padding: 0 18px; border-radius: 10px; border: 1px solid #d9dce3; background: #fff; color: var(--navy); font-size: 16px; text-decoration: none; transition: background .15s, border-color .15s; white-space: nowrap; }
.btn:hover { border-color: #b9bec9; background: #fafafa; }
.btn.primary { background: var(--orange); border-color: var(--orange); color: #fff; }
.btn.primary:hover { background: var(--orange-d); }
.btn.small { height: 32px; padding: 0 12px; font-size: 14px; }
.icon-btn { width: 42px; height: 42px; border-radius: 10px; border: 1px solid #d9dce3; background: #fff; color: var(--navy); display: inline-flex; align-items: center; justify-content: center; }
.icon-btn:hover { background: #f6f7f9; }
.icon-btn.ghost { border-color: transparent; background: transparent; }
.icon-btn.ghost:hover { background: #f3f4f6; }
.icon-btn.on { color: var(--orange); background: var(--orange-soft); }

/* landing */
main { flex: 1; width: 100%; max-width: 1400px; margin: 0 auto; padding: 0 24px 24px; display: flex; flex-direction: column; }
.hero { text-align: center; padding: 70px 0 22px; }
.brand { font-size: clamp(48px, 7vw, 84px); font-weight: 800; letter-spacing: -.035em; margin: 0; line-height: 1.05; }
.tagline { color: var(--muted); font-size: clamp(18px, 2vw, 26px); line-height: 1.35; margin: 18px 0 18px; }
.rule { width: 146px; height: 4px; background: var(--orange); border-radius: 4px; margin: 0 auto 50px; }
.ask { font-size: clamp(22px, 2.6vw, 34px); color: var(--navy); margin: 0; font-weight: 800; letter-spacing: -.01em; }

/* composer */
.composer { width: 100%; max-width: 1180px; margin: 26px auto 0; border: 2.5px solid var(--orange); border-radius: 26px; background: #fff; padding: 20px 26px 14px 26px; box-shadow: 0 4px 24px rgba(244,122,31,.08); }
.composer textarea { width: 100%; border: 0; outline: 0; resize: none; font: inherit; font-size: 18px; line-height: 1.5; color: var(--ink); min-height: 56px; max-height: 260px; background: transparent; }
.composer textarea::placeholder { color: #697386; }
.composer .row { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.composer .spacer { flex: 1; }
.status { color: var(--muted); font-size: 14px; }
.send { width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--orange); color: #fff; display: inline-flex; align-items: center; justify-content: center; }
.send:disabled { background: #f8c9a6; cursor: default; }
.send.stop { background: var(--navy); }
.attachments { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--orange-soft); border: 1px solid var(--orange-line); border-radius: 999px; padding: 4px 6px 4px 12px; font-size: 14px; color: var(--navy); }
.chip button { border: 0; background: transparent; color: var(--muted); padding: 0 4px; font-size: 16px; line-height: 1; }

/* model selector */
.model { position: relative; }
.model-btn { display: inline-flex; align-items: center; gap: 4px; border: 0; background: transparent; font-size: 18px; color: var(--navy); padding: 6px 8px; border-radius: 8px; }
.model-btn:hover { background: #f3f4f6; }
.model-btn svg { width: 18px; height: 18px; color: var(--muted); }
.model-list { position: absolute; right: 0; bottom: 46px; width: 380px; max-height: 420px; overflow: auto; list-style: none; margin: 0; padding: 6px; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 12px 40px rgba(15,23,42,.14); z-index: 30; }
.model-list li { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 9px 10px; border-radius: 10px; cursor: pointer; }
.model-list li:hover, .model-list li[aria-selected="true"] { background: var(--orange-soft); }
.model-list .name { font-weight: 600; color: var(--navy); }
.model-list .tier { font-size: 12px; color: var(--orange-d); text-transform: uppercase; letter-spacing: .04em; align-self: center; }
.model-list .price { grid-column: 1 / 3; font-size: 12.5px; color: var(--muted); }
.quota-alert { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; padding: 9px 12px; border-radius: 12px; background: #fff7ed; border: 1px solid #fdba74; color: #7c2d12; font-size: 14px; line-height: 1.4; }
.quota-alert[hidden] { display: none; }
.quota-alert.out { background: #fef2f2; border-color: #fca5a5; color: #7f1d1d; }
.quota-alert svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.quota-alert span { flex: 1; }
.quota-close { flex: none; border: 0; background: none; color: inherit; font-size: 22px; line-height: 1; cursor: pointer; padding: 0 4px; opacity: .7; }
.quota-close:hover { opacity: 1; }
.top .btn.dev-reset { background: #fef3c7; border: 1px dashed #d97706; color: #92400e; font-weight: 600; }
.model-list li.premium { cursor: default; opacity: .6; }
.model-list li.premium:hover { background: none; }
.model-list .badge-premium { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: #fff; background: linear-gradient(135deg, #f59e0b, #d97706); padding: 2px 8px; border-radius: 999px; align-self: center; }
.model-list .group { padding: 8px 10px 4px; font-size: 12px; color: var(--muted); cursor: default; background: none !important; display: block; }

/* suggestion cards */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 12px; width: 100%; max-width: 1180px; margin: 26px auto 0; }
.card { display: flex; align-items: center; gap: 12px; text-align: left; padding: 10px 14px; min-height: 0; border-radius: 8px; border: 1px solid #ece4dc; background: #fffcf9; color: var(--navy); font-size: 14.5px; line-height: 1.35; font-weight: 500; }
.card:hover { border-color: var(--orange); }
.card:focus-visible { outline: none; border-color: var(--orange); box-shadow: 0 0 0 3px rgba(244,122,31,.18); }
.card svg { width: 24px; height: 24px; color: var(--orange); stroke-width: 1.7; }

/* chat */
body.chatting .hero, body.chatting .cards { display: none; }
body.chatting main { max-width: 980px; }
body.chatting .composer { position: sticky; bottom: 14px; margin-top: 10px; max-width: 980px; padding: 12px 18px 10px; }
body.chatting .composer textarea { font-size: 16px; min-height: 30px; }
.chat { flex: 1; padding: 26px 0 8px; display: flex; flex-direction: column; gap: 22px; }
.msg.user { align-self: flex-end; max-width: 80%; background: var(--orange-soft); border: 1px solid var(--orange-line); border-radius: 18px 18px 4px 18px; padding: 12px 16px; white-space: pre-wrap; font-size: 16px; line-height: 1.5; }
.msg.user .att { display: block; margin-top: 6px; font-size: 13px; color: var(--muted); }
.msg.bot { align-self: stretch; font-size: 16px; line-height: 1.6; }
.msg.bot .who { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.msg.bot .who b { color: var(--orange); }
.answer > :first-child { margin-top: 0; }
.answer h3, .answer h4, .answer h5 { color: var(--navy); margin: 18px 0 6px; }
.answer p { margin: 8px 0; }
.answer ul, .answer ol { margin: 6px 0 6px 0; padding-left: 22px; }
.answer li { margin: 3px 0; }
.answer code { background: #f3f4f7; border-radius: 5px; padding: 1px 5px; font-size: .9em; font-family: var(--mono); }
.answer a { color: var(--orange-d); }
.answer blockquote { margin: 8px 0; padding: 4px 12px; border-left: 3px solid var(--orange-line); color: var(--muted); }
.codeblock { position: relative; margin: 10px 0; }
.codeblock pre { background: #0f172a; color: #e5e7eb; border-radius: 12px; padding: 14px 16px; overflow: auto; font-size: 13.5px; line-height: 1.5; margin: 0; }
.codeblock pre code { background: none; padding: 0; color: inherit; }
.codeblock .copy { position: absolute; top: 8px; right: 8px; border: 1px solid #334155; background: #1e293b; color: #cbd5e1; font-size: 12px; border-radius: 6px; padding: 2px 8px; }
.table { overflow: auto; margin: 10px 0; border: 1px solid var(--line); border-radius: 10px; }
.table table { border-collapse: collapse; width: 100%; font-size: 14px; }
.table th, .table td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.table th { background: #f8f9fb; color: var(--navy); }
.table tr:last-child td { border-bottom: 0; }
.cite { border: 1px solid var(--orange-line); background: var(--orange-soft); color: var(--orange-d); border-radius: 6px; font-size: 11.5px; padding: 0 5px; vertical-align: 1px; }
.caret::after { content: "▍"; color: var(--orange); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.steps { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 10px; }
.step { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.step .dot { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--orange-line); border-top-color: var(--orange); animation: spin .8s linear infinite; flex: none; }
.step.ok .dot { animation: none; border: 0; background: var(--ok); mask: none; }
.step.ok .dot::after { content: "✓"; color: #fff; font-size: 11px; display: flex; align-items: center; justify-content: center; height: 100%; }
.step.bad .dot { animation: none; border: 0; background: var(--bad); }
.step.bad .dot::after { content: "!"; color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; height: 100%; }
@keyframes spin { to { transform: rotate(360deg); } }

.run { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin: 10px 0 14px; background: var(--panel); box-shadow: var(--shadow); }
.run-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.run-head .title { font-weight: 700; color: var(--navy); }
.badge { font-size: 12px; border-radius: 999px; padding: 2px 9px; background: #eef2f7; color: var(--muted); }
.badge.done { background: #e7f6ec; color: var(--ok); }
.badge.failed { background: #fdecea; color: var(--bad); }
.badge.running { background: var(--orange-soft); color: var(--orange-d); }
.run-head .grow { flex: 1; }
.run pre.cmd { background: #0f172a; color: #e5e7eb; border-radius: 10px; padding: 10px 12px; font-size: 12.5px; white-space: pre-wrap; word-break: break-word; margin: 10px 0; }
.run details { margin-top: 6px; }
.run summary { cursor: pointer; color: var(--muted); font-size: 13.5px; }
.run .log { max-height: 220px; overflow: auto; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font: 12px/1.5 var(--mono); white-space: pre-wrap; margin-top: 6px; }
.files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.file { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 4px 10px; font-size: 13px; color: var(--navy); }
.file:hover { border-color: var(--orange-line); background: var(--orange-soft); }
.file.key { border-color: var(--orange-line); }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-top: 10px; }
.thumbs button { border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 4px; }
.thumbs img { width: 100%; display: block; border-radius: 4px; }
.thumbs span { display: block; font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sources { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; align-items: center; font-size: 12.5px; color: var(--muted); }
.meta-line { font-size: 12px; color: var(--muted); margin-top: 6px; }
.error { color: var(--bad); background: #fdecea; border: 1px solid #f8c9c4; border-radius: 10px; padding: 10px 12px; margin: 8px 0; }

/* drawer and modal */
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, 100vw); background: #fff; border-left: 1px solid var(--line); box-shadow: -10px 0 40px rgba(15,23,42,.10); z-index: 40; display: flex; flex-direction: column; }
.drawer-head, .modal-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.drawer-head h3, .modal-head h3 { margin: 0; flex: 1; font-size: 17px; color: var(--navy); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer-body { overflow: auto; padding: 12px 16px 24px; }
.drawer-body h4 { margin: 14px 0 6px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.item { display: block; width: 100%; text-align: left; border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 9px 12px; margin: 6px 0; color: var(--navy); }
.item:hover { border-color: var(--orange-line); background: var(--orange-soft); }
.item small { display: block; color: var(--muted); margin-top: 2px; }
.modal { position: fixed; inset: 0; background: rgba(15,23,42,.38); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-box { background: #fff; border-radius: 16px; width: min(1100px, 100%); max-height: 90vh; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 20px 60px rgba(15,23,42,.25); }
.modal-actions { display: flex; gap: 8px; }
.modal-body { overflow: auto; padding: 16px 18px 22px; }
.modal-body pre.text { font: 13px/1.5 var(--mono); white-space: pre; margin: 0; }
.modal-body img { max-width: 100%; display: block; margin: 0 auto; }
.help-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.help-grid ul { padding-left: 18px; }

.foot { text-align: center; color: #98a1b1; font-size: 12.5px; margin-top: 28px; }
.foot a { color: inherit; text-decoration: none; }
.foot a:hover { color: var(--orange-d); text-decoration: underline; }
body.chatting .foot { display: none; }
[hidden] { display: none !important; }

@media (max-width: 1000px) {
  .cards { grid-template-columns: 1fr 1fr; }
  #manualApp, #moreFeatures { display: none; }
}
@media (max-width: 640px) {
  .top { padding: 8px 10px; }
  #convBtn { font-size: 0; padding: 0 9px; gap: 0; }
  #convBtn .count { font-size: 12px; }
  .modal.wide { padding: 0; }
  .modal.wide .modal-box { width: 100vw; height: 100vh; max-height: none; border-radius: 0; }
  .modal-actions .btn small, .modal-actions .btn { padding: 0 8px; }
  .modal-actions [data-full] { display: none; }
  .convs { padding: 0; }
  .convs-box { max-height: 100vh; height: 100vh; border-radius: 0; }
  main { padding: 0 14px 16px; }
  .hero { padding-top: 34px; }
  .cards { grid-template-columns: 1fr; gap: 12px; }
  .card { font-size: 14px; }
  .composer { padding: 14px 16px 10px; border-radius: 20px; }
  .model-list { width: calc(100vw - 40px); right: -60px; }
  .help-grid { grid-template-columns: 1fr; }
  .msg.user { max-width: 92%; }
}
.model-btn { white-space: nowrap; }
@media (max-width: 640px) { .model-btn { font-size: 15px; } }

/* run progress */
.progress { margin: 10px 0 6px; }
.progress .bar { position: relative; height: 8px; border-radius: 999px; background: #eef0f4; overflow: hidden; }
.progress .bar span { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, var(--orange), #fb9a4b); border-radius: 999px; transition: width .4s ease; }
.progress .bar i { position: absolute; inset: 0; background: linear-gradient(90deg, transparent 0, rgba(255,255,255,.55) 50%, transparent 100%); width: 40%; animation: sweep 1.4s linear infinite; }
@keyframes sweep { from { transform: translateX(-100%); } to { transform: translateX(260%); } }
.progress.done .bar span { background: var(--ok); }
.progress.failed .bar span { background: var(--bad); }
.progress.queued .bar span { background: #cbd5e1; }
.prog-row { display: flex; align-items: center; gap: 10px; margin-top: 6px; font-size: 13.5px; color: var(--muted); }
.prog-row .pct { font-weight: 700; color: var(--navy); min-width: 38px; }
.prog-row .now { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prog-row .grow { flex: 1; }
.prog-row .elapsed b { color: var(--navy); font-variant-numeric: tabular-nums; }
.ms { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 8px 0 0; padding: 0; font-size: 13px; color: #8a93a3; }
.ms li { display: flex; align-items: center; gap: 6px; }
.ms .b { width: 14px; height: 14px; border-radius: 50%; border: 2px solid #d5d9e1; flex: none; }
.ms li.done { color: var(--ink); }
.ms li.done .b { border: 0; background: var(--ok); position: relative; }
.ms li.done .b::after { content: "✓"; color: #fff; font-size: 9px; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.ms li.current { color: var(--orange-d); font-weight: 600; }
.ms li.current .b { border-color: var(--orange-line); border-top-color: var(--orange); animation: spin .8s linear infinite; }
.ms li.failed { color: var(--bad); }
.ms li.failed .b { border: 0; background: var(--bad); }

/* nlmx console */
.term { margin-top: 10px; border-radius: 12px; overflow: hidden; background: #0b1020; border: 1px solid #1c2440; box-shadow: inset 0 1px 0 rgba(255,255,255,.04); }
.term-head { display: flex; align-items: center; gap: 10px; padding: 7px 12px; background: #121a33; color: #9aa6c5; font-size: 12.5px; cursor: pointer; list-style: none; user-select: none; }
.term.live .term-head { cursor: default; }
.term-head::-webkit-details-marker { display: none; }
details.term:not([open]) .term-head::after { content: "show"; color: #f6a35f; margin-left: 8px; }
details.term[open] .term-head::after { content: "hide"; color: #f6a35f; margin-left: 8px; }
.term-head .dots { display: inline-flex; gap: 5px; }
.term-head .dots i { width: 9px; height: 9px; border-radius: 50%; background: #ff5f57; display: block; }
.term-head .dots i:nth-child(2) { background: #febc2e; }
.term-head .dots i:nth-child(3) { background: #28c840; }
.term-head .ctitle { color: #cfd6ea; font-weight: 600; }
.term-head .grow { flex: 1; }
.console { max-height: 300px; overflow: auto; padding: 10px 12px 12px; font: 12.5px/1.55 var(--mono); color: #c8d0e6; white-space: pre-wrap; word-break: break-word; scrollbar-color: #2a3558 #0b1020; }
.console .t { color: #5b6788; }
.console .lv { font-weight: 700; }
.console .lv-stage .lv { color: #4fd1e8; }
.console .lv-stage .msg { color: #ffffff; font-weight: 600; }
.console .lv-info .lv { color: #8b9ac4; }
.console .lv-info .msg { color: #b6c0dc; }
.console .lv-ok .lv { color: #4ade80; }
.console .lv-ok .msg { color: #d1fae5; }
.console .lv-warn .lv, .console .lv-warn .msg { color: #fbbf24; }
.console .lv-error .lv, .console .lv-error .msg { color: #f87171; font-weight: 600; }
.console .cursor { color: #f47a1f; animation: blink 1s steps(2) infinite; }
.console .ln[class*="lv-"] { padding-left: 15ch; text-indent: -15ch; }

/* header: compact buttons */
.top .btn { height: 34px; padding: 0 11px; font-size: 14px; border-radius: 8px; gap: 6px; }
.top .btn svg { width: 17px; height: 17px; }
.top .icon-btn { width: 34px; height: 34px; border-radius: 8px; }
.top .icon-btn svg { width: 19px; height: 19px; }
.icon-btn.primary { background: var(--orange); border-color: var(--orange); color: #fff; }
.icon-btn.primary:hover { background: var(--orange-d); }
.icon-btn.primary svg { stroke-width: 2.3; }
#convBtn .count { color: var(--muted); font-variant-numeric: tabular-nums; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: #f3f4f6; }
.btn.small svg { width: 16px; height: 16px; }

/* conversations (as in Corelix Unified) */
.convs { position: fixed; inset: 0; z-index: 60; background: rgba(15,23,42,.55); display: flex; align-items: flex-start; justify-content: center; padding: 24px; }
.convs-box { width: min(672px, 100%); max-height: 85vh; display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; box-shadow: 0 20px 60px rgba(15,23,42,.25); }
.convs-head { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.convs-head h2 { margin: 0; font-size: 15px; font-weight: 800; color: var(--navy); }
.convs-head p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.convs-head .grow { flex: 1; }
.convs-ico { width: 36px; height: 36px; border-radius: 9px; background: var(--orange); color: #fff; display: grid; place-items: center; }
.convs-ico svg { width: 18px; height: 18px; }
.convs-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; min-height: 0; flex: 1; }
.convs-list li { display: flex; align-items: center; gap: 4px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.convs-list li:last-child { border-bottom: 0; }
.convs-list li.active { background: var(--orange-soft); }
.convs-list li.empty { padding: 16px; color: var(--muted); font-size: 14px; }
.convs-list .open { flex: 1; min-width: 0; text-align: left; border: 0; background: transparent; border-radius: 8px; padding: 4px 8px; color: var(--navy); }
.convs-list .open:hover { background: #f4f5f8; }
.convs-list li.active .open:hover { background: #ffe9d8; }
.convs-list .open b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.convs-list .open small { display: block; font-size: 11px; color: #8a93a3; margin-top: 1px; }
.convs-list .ico { width: 28px; height: 28px; flex: none; border: 0; border-radius: 6px; background: transparent; color: #98a1b1; display: grid; place-items: center; }
.convs-list .ico svg { width: 15px; height: 15px; }
.convs-list .ico:hover { background: #f1f2f5; color: var(--navy); }
.convs-list .ico.bad:hover { color: var(--bad); }
.convs-list .rename { flex: 1; min-width: 0; display: flex; }
.convs-list .rename input { flex: 1; min-width: 0; height: 32px; border: 1px solid var(--orange); border-radius: 6px; padding: 0 8px; font: inherit; font-size: 14px; outline: none; }

/* large file viewer */
.modal.wide { padding: 2vh 2vw; }
.modal.wide .modal-box { width: min(1500px, 96vw); height: 94vh; max-height: none; }
.modal.full { padding: 0; }
.modal.full .modal-box { width: 100vw; height: 100vh; border-radius: 0; }
.modal.wide .modal-head { padding: 10px 14px; flex-wrap: wrap; }
.modal.wide .modal-head h3 { font-family: var(--mono); font-size: 15px; }
.modal-actions { align-items: center; flex-wrap: wrap; }
.modal-body.viewer { padding: 0; flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.viewer-note { padding: 24px; color: var(--muted); margin: 0; }
.seg { display: inline-flex; background: #f1f3f6; border-radius: 8px; padding: 3px; }
.seg button { border: 0; background: transparent; height: 26px; padding: 0 12px; border-radius: 6px; font-size: 13px; font-weight: 700; color: var(--muted); }
.seg button[aria-checked="true"] { background: var(--orange); color: #fff; }
.seg button:not([aria-checked="true"]):hover { color: var(--navy); }

.code-viewer, .grid-viewer, .img-viewer { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.cv-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 3px; padding: 5px 8px; border-bottom: 1px solid var(--line); background: #f7f8fa; }
.cv-tools button { min-width: 30px; height: 28px; padding: 0 7px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.cv-tools button svg { width: 15px; height: 15px; }
.cv-tools button:hover { background: #eceef2; color: var(--navy); }
.cv-tools button.on { background: var(--orange); color: #fff; }
.cv-tools .sep { width: 1px; height: 16px; background: #d9dce3; margin: 0 4px; }
.cv-tools .zl { margin-left: 8px; font-size: 12px; color: var(--muted); }
.cv-editor { flex: 1; min-height: 0; }
.cv-status { display: flex; flex-wrap: wrap; gap: 4px 16px; padding: 4px 12px; border-top: 1px solid var(--line); background: #f7f8fa; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.cv-status b { color: var(--navy); }
.cv-status .grow { flex: 1; }

.md-preview { flex: 1; overflow: auto; padding: 22px 28px 40px; }
.md-preview article { max-width: 860px; margin: 0 auto; }
.md-preview table { border-collapse: collapse; margin: 10px 0; font-size: 14px; }
.md-preview th, .md-preview td { border: 1px solid var(--line); padding: 5px 10px; text-align: left; }
.md-preview th { background: #f7f8fa; }
.md-preview pre { background: #0b1020; color: #e2e8f0; padding: 12px 14px; border-radius: 10px; overflow: auto; font: 13px/1.5 var(--mono); }
.md-preview :not(pre) > code { background: #f1f3f6; padding: 1px 5px; border-radius: 4px; font-size: .92em; }

.gv-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.gv-bar .grow, .gv-foot .grow { flex: 1; }
.gv-search { position: relative; flex: 1 1 220px; max-width: 380px; }
.gv-search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: #98a1b1; }
.gv-search input { width: 100%; height: 34px; border: 1px solid #d9dce3; border-radius: 8px; padding: 0 10px 0 32px; font: inherit; font-size: 14px; }
.gv-search input:focus { outline: none; border-color: var(--orange); box-shadow: 0 0 0 3px rgba(244,122,31,.18); }
.gv-dv { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.gv-dv select, .gv-foot select { height: 30px; border: 1px solid #d9dce3; border-radius: 6px; font: inherit; font-size: 13px; padding: 0 4px; background: #fff; }
.gv-count { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.gv-scroll { flex: 1; min-height: 0; overflow: auto; }
.gv-scroll table { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; font: 12.5px/1.4 var(--mono); }
.gv-scroll th { position: sticky; top: 0; z-index: 2; background: #f4f5f8; border-bottom: 1px solid var(--line); padding: 0; text-align: left; }
.gv-scroll th button { border: 0; background: transparent; width: 100%; padding: 7px 12px; font: inherit; font-weight: 700; color: var(--navy); text-align: left; display: flex; gap: 4px; white-space: nowrap; }
.gv-scroll th button:hover { color: var(--orange-d); }
.gv-scroll th .arrow { color: var(--orange); }
.gv-scroll td { padding: 3px 12px; white-space: nowrap; border-bottom: 1px solid #f1f2f5; }
.gv-scroll td.num { text-align: right; font-variant-numeric: tabular-nums; }
.gv-scroll tbody tr:nth-child(even) { background: #fafbfc; }
.gv-scroll tbody tr:hover { background: #f3f6fb; }
.gv-scroll tr.dose, .gv-scroll tr.dose .rn { background: #fff4d6; }
.gv-scroll .rn { position: sticky; left: 0; z-index: 1; background: #fff; color: #98a1b1; text-align: right; border-right: 1px solid var(--line); padding: 3px 8px; }
.gv-scroll th.rn { z-index: 3; background: #f4f5f8; padding: 7px 8px; }
.gv-scroll tbody tr:nth-child(even) .rn { background: #fafbfc; }
.gv-scroll td.none { text-align: center; padding: 30px; font-family: inherit; color: var(--muted); }
.gv-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 8px 12px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.gv-foot label { display: flex; align-items: center; gap: 6px; font-size: 12.5px; }
.gv-foot .legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; background: #ffd66b; vertical-align: middle; margin-right: 4px; }
.gv-foot .pg { height: 30px; padding: 0 10px; border: 0; border-radius: 6px; background: transparent; color: var(--navy); font-size: 13px; }
.gv-foot .pg:hover:not(:disabled) { background: #f1f2f5; }
.gv-foot .pg:disabled { color: #c3c8d2; cursor: default; }
.gv-foot input { width: 52px; height: 30px; border: 1px solid #d9dce3; border-radius: 6px; text-align: center; font: inherit; font-size: 13px; font-weight: 600; }

.iv-stage { flex: 1; min-height: 0; overflow: auto; display: flex; align-items: flex-start; justify-content: center; padding: 16px; background: #f7f8fa; }
.iv-stage img { max-width: 100%; max-height: 100%; object-fit: contain; background: #fff; box-shadow: 0 2px 12px rgba(15,23,42,.08); cursor: zoom-in; margin: auto; }
.md-preview pre code { background: transparent; color: inherit; padding: 0; border: 0; font: inherit; }

/* type (as Corelix Data): IBM Plex Sans throughout, Plus Jakarta Sans 800 for the wordmark, IBM Plex Mono for code */
.brand, .brand-mini { font-family: var(--display); font-weight: 800; letter-spacing: -0.02em; }
.composer textarea, input, select, textarea { font-family: var(--sans); }

/* header: New (orange) and Files (navy) */
.top .btn.files-btn { background: var(--blue); border: 0; color: #fff; font-weight: 600; }
.top .btn.files-btn:hover { background: var(--blue-d); }
.top .btn.files-btn.on { background: var(--blue-d); box-shadow: inset 0 0 0 2px rgba(255,255,255,.25); }
.top .btn .count { font-size: 12px; font-weight: 600; opacity: .75; font-variant-numeric: tabular-nums; }
.top .btn.files-btn .count { background: rgba(255,255,255,.18); border-radius: 999px; padding: 1px 7px; margin-left: 2px; opacity: 1; }
.top .btn.primary { font-weight: 600; }

/* files panel */
.files-panel { position: fixed; top: var(--hdr, 51px); right: 0; bottom: 0; width: min(430px, 100vw); background: #fafbfc; border-left: 1px solid var(--line); box-shadow: -12px 0 32px rgba(15,23,42,.06); z-index: 25; display: flex; flex-direction: column; }
.fp-head { display: flex; align-items: center; gap: 10px; padding: 12px 12px 10px 16px; background: #fff; border-bottom: 1px solid var(--line); }
.fp-ico { width: 32px; height: 32px; border-radius: 8px; background: var(--blue); color: #fff; display: grid; place-items: center; flex: none; }
.fp-ico svg { width: 17px; height: 17px; }
.fp-title { flex: 1; min-width: 0; }
.fp-title h3 { margin: 0; font-size: 15px; font-weight: 700; color: var(--navy); }
.fp-title p { margin: 1px 0 0; font-size: 12px; color: var(--muted); }
.icon-btn.sm { width: 30px; height: 30px; border-radius: 7px; }
.icon-btn.sm svg { width: 17px; height: 17px; }
.fp-tools { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; background: #fff; border-bottom: 1px solid var(--line); }
.fp-search { position: relative; }
.fp-search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: #98a1b1; }
.fp-search input { width: 100%; height: 32px; border: 1px solid #d9dce3; border-radius: 7px; padding: 0 10px 0 31px; font-size: 13.5px; background: #fff; }
.fp-search input:focus { outline: none; border-color: var(--orange); box-shadow: 0 0 0 3px rgba(244,122,31,.15); }
.fp-tools .seg { align-self: flex-start; }
.fp-tools .seg button { height: 24px; padding: 0 10px; font-size: 12px; }
.fp-list { flex: 1; min-height: 0; overflow-y: auto; padding: 10px 12px 16px; display: flex; flex-direction: column; gap: 8px; }
.fp-empty { color: var(--muted); font-size: 13.5px; padding: 18px 6px; margin: 0; text-align: center; }
.fp-more { display: block; width: 100%; margin: 4px 0 10px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); font: inherit; font-size: 13px; cursor: pointer; }
.fp-more:hover:not(:disabled) { border-color: var(--orange-line); background: var(--orange-soft); }
.fp-more:disabled { color: var(--muted); cursor: default; }
.fp-foot { padding: 8px 14px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); background: #fff; }
.fp-foot:empty { display: none; }
.fp-run { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; border-left: 3px solid #cbd5e1; }
.fp-run.done { border-left-color: var(--ok); }
.fp-run.failed { border-left-color: var(--bad); }
.fp-run.running { border-left-color: var(--orange); }
.fp-run.mine { box-shadow: 0 0 0 1px var(--orange-line); }
.fp-r1 { display: flex; align-items: baseline; gap: 8px; }
.fp-r1 b { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fp-r1 time { font-size: 11.5px; color: #8a93a3; white-space: nowrap; }
.fp-r1 .dot { width: 8px; height: 8px; border-radius: 50%; background: #cbd5e1; flex: none; align-self: center; }
.fp-run.done .dot { background: var(--ok); }
.fp-run.failed .dot { background: var(--bad); }
.fp-run.running .dot { background: var(--orange); animation: blink 1s steps(2) infinite; }
.fp-cmd { display: block; margin-top: 5px; font-family: var(--mono); font-size: 11.5px; color: #475569; background: #f6f7f9; border-radius: 5px; padding: 3px 7px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fp-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 7px; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pill { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 2px 7px; border-radius: 999px; }
.pill.done { background: #e7f6ec; color: var(--ok); }
.pill.failed { background: #fdecea; color: var(--bad); }
.pill.running { background: var(--orange-soft); color: var(--orange-d); }
.pill.here { background: #eef2ff; color: #3730a3; }
.fp-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 8px; padding-top: 8px; border-top: 1px dashed #e6e8ee; }
.fp-actions button, .fp-actions a { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 8px; border: 1px solid transparent; border-radius: 6px; background: transparent; font-size: 12.5px; font-weight: 600; color: var(--navy); text-decoration: none; }
.fp-actions button:hover, .fp-actions a:hover { border-color: #d9dce3; background: #f8f9fb; }
.fp-actions svg { width: 14px; height: 14px; }
.fp-toggle svg { transition: transform .15s; }
.fp-toggle[aria-expanded="true"] svg { transform: rotate(90deg); }
.fp-toggle { color: var(--orange-d) !important; }
.fp-actions .zip { margin-left: auto; }
.fp-tree { margin-top: 6px; border-top: 1px solid #f0f1f4; padding-top: 4px; }
.fp-dir { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding: 7px 4px 3px; font-family: var(--mono); }
.fp-dir span { font-weight: 500; color: #a3abb9; }
.fp-file { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: transparent; padding: 4px 4px; border-radius: 5px; text-align: left; color: var(--ink); }
.fp-file.in { padding-left: 14px; }
.fp-file:hover { background: var(--orange-soft); }
.fp-file span { flex: 1; min-width: 0; font-family: var(--mono); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fp-file small { font-size: 11px; color: #98a1b1; font-variant-numeric: tabular-nums; }
.fp-file i { font-style: normal; font-size: 9px; font-weight: 700; width: 30px; text-align: center; padding: 2px 0; border-radius: 3px; background: #eef0f4; color: #475569; flex: none; }
.fp-file i.k-img { background: #f3e8ff; color: #7e22ce; }
.fp-file i.k-csv { background: #dcfce7; color: #15803d; }
.fp-file i.k-ctl { background: #ffedd5; color: #c2410c; }
.fp-file i.k-md { background: #dbeafe; color: #1d4ed8; }
.fp-file i.k-cfg { background: #fef9c3; color: #a16207; }
@media (min-width: 1280px) { body.files-open main { margin-right: 430px; } }
@media (max-width: 640px) {
  .top .btn.primary, .top .btn.files-btn { padding: 0 9px; }
  .top .btn.files-btn .count { display: none; }
}
.top .btn .count:empty { display: none; }
.fp-file i.k-tab { background: #e0f2fe; color: #0369a1; }
.noscript { max-width: 760px; margin: 28px auto 0; padding: 16px 20px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); line-height: 1.6; }
.noscript h2 { margin: 0 0 6px; font-size: 18px; color: var(--navy); }

/* Help & About (after HyperPKPD Tutor): a title block, a menu of sections and the text, which the menu follows */
.modal.about-modal .modal-box { width: min(1080px, 96vw); height: min(820px, 92vh); }
.modal.about-modal .modal-head { background: #f6f7f9; padding: 9px 14px; }
.modal.about-modal .modal-head h3 { font-family: var(--sans); font-size: 14px; font-weight: 600; text-align: center; color: var(--ink); }
.about-site { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--blue); text-decoration: none; font-weight: 500; }
.about-site:hover { text-decoration: underline; }
.about-site svg { width: 14px; height: 14px; }
.about { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.about-head { display: flex; align-items: center; gap: 14px; padding: 16px 22px; border-bottom: 1px solid var(--line); }
.about-logo img { width: 40px; height: 40px; display: block; border-radius: 9px; }
.about-head h2 { margin: 0; font-size: 19px; font-weight: 700; color: var(--navy); }
.about-head p { margin: 3px 0 0; font-size: 13px; color: var(--muted); }
.about-head a, .about-body a { color: var(--blue); }
.about-main { flex: 1; min-height: 0; display: grid; grid-template-columns: 236px 1fr; }
.about-nav { border-right: 1px solid var(--line); background: #f8f9fb; padding: 10px 8px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.about-nav a { display: block; padding: 7px 12px; border-radius: 7px; font-size: 13.5px; color: #3b4556; text-decoration: none; line-height: 1.3; }
.about-nav a:hover { background: #eef0f4; color: var(--navy); }
.about-nav a[aria-current="true"] { background: var(--blue); color: #fff; font-weight: 600; }
.about-nav a:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
.about-body { overflow-y: auto; padding: 6px 30px 40px; font-size: 14.5px; line-height: 1.65; color: var(--ink); scroll-behavior: smooth; outline: none; }
.about-body section { padding-top: 18px; scroll-margin-top: 8px; }
.about-body section + section { border-top: 1px solid #f0f1f4; margin-top: 10px; }
.about-body h3 { margin: 0 0 8px; font-size: 18px; font-weight: 700; color: var(--blue); }
.about-body p { margin: 8px 0; }
.about-body ul, .about-body ol { margin: 8px 0; padding-left: 22px; }
.about-body li { margin: 5px 0; }
.about-body code { font-family: var(--mono); font-size: .88em; background: #f3f4f7; border: 1px solid #e9ebf0; padding: 0 5px; border-radius: 4px; }
.about-body .facts { display: grid; grid-template-columns: 130px 1fr; gap: 6px 14px; margin: 14px 0 4px; padding: 12px 16px; background: #f8f9fb; border: 1px solid var(--line); border-radius: 8px; }
.about-body .facts dt { font-weight: 600; color: var(--navy); }
.about-body .facts dd { margin: 0; }
.about-body .tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 8px; }
.about-body .tiles div { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.about-body .tiles b { display: block; color: var(--navy); font-size: 14px; }
.about-body .tiles span { font-size: 13.5px; color: var(--muted); line-height: 1.45; }
.about-body ul.checks, .about-body ul.crosses { list-style: none; padding-left: 0; }
.about-body ul.checks li, .about-body ul.crosses li { position: relative; padding-left: 26px; }
.about-body ul.checks li::before, .about-body ul.crosses li::before { position: absolute; left: 0; top: 3px; width: 17px; height: 17px; border-radius: 50%; display: grid; place-items: center; font-size: 10px; font-weight: 700; }
.about-body ul.checks li::before { content: "✓"; background: #e7f6ec; color: var(--ok); }
.about-body ul.crosses li::before { content: "✕"; background: #fdecea; color: var(--bad); }
.about-body ol.steps-list { list-style: none; padding-left: 0; counter-reset: st; }
.about-body ol.steps-list li { counter-increment: st; position: relative; padding-left: 36px; margin: 10px 0; }
.about-body ol.steps-list li::before { content: counter(st); position: absolute; left: 0; top: 1px; width: 24px; height: 24px; border-radius: 50%; background: var(--orange); color: #fff; font-size: 12.5px; font-weight: 700; display: grid; place-items: center; }
.about-body .tries { display: flex; flex-direction: column; gap: 6px; }
.about-body .try { display: flex; align-items: center; gap: 10px; text-align: left; border: 1px solid #ece4dc; background: #fffcf9; border-radius: 8px; padding: 8px 12px; font-size: 14px; color: var(--navy); }
.about-body .try:hover { border-color: var(--orange); }
.about-body .try svg { width: 16px; height: 16px; color: var(--orange); }
.about-body table.kv { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: 14px; }
.about-body table.kv td { border-bottom: 1px solid #f0f1f4; padding: 7px 10px 7px 0; vertical-align: top; }
.about-body table.kv td:first-child { white-space: nowrap; font-weight: 600; color: var(--navy); width: 1%; padding-right: 18px; }
.about-body .kb { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.about-body .kb button { text-align: left; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 8px 12px; }
.about-body .kb button:hover { border-color: var(--blue); }
.about-body .kb b { display: block; font-size: 13.5px; font-weight: 600; color: var(--navy); }
.about-body .kb small { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.about-end { margin-top: 26px !important; font-size: 12.5px; color: #98a1b1; }
@media (max-width: 760px) {
  .about-main { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .about-nav { flex-direction: row; overflow-x: auto; overflow-y: hidden; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px; scrollbar-width: none; }
  .about-nav a { white-space: nowrap; flex: none; }
  .about-body { padding: 4px 16px 30px; }
  .about-body .tiles, .about-body .kb { grid-template-columns: 1fr; }
  .about-head { padding: 12px 16px; }
  .modal.about-modal .modal-box { width: 100vw; height: 100vh; }
}

/* composer controls: smaller, in proportion with the text */
.composer .model-btn { font-size: 14px; font-weight: 500; padding: 5px 8px; gap: 3px; }
.composer .model-btn svg { width: 15px; height: 15px; }
.composer .icon-btn { width: 34px; height: 34px; border-radius: 8px; }
.composer .icon-btn svg { width: 18px; height: 18px; }
.composer .send { width: 36px; height: 36px; }
.composer .send svg { width: 18px; height: 18px; }
@media (max-width: 640px) { .composer .model-btn { font-size: 13.5px; } }

/* plot viewer (after Corelix Unified): toolbar, a stage to zoom and move the plot in, thumbnails */
.iv { display: flex; flex-direction: column; flex: 1; min-height: 0; background: #fff; outline: none; }
.iv:focus-visible { box-shadow: inset 0 0 0 2px rgba(29,78,216,.35); }
.iv.is-full { height: 100vh; }
.iv-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 5px 10px; border-bottom: 1px solid var(--line); }
.iv-bar button { min-width: 32px; height: 32px; padding: 0 6px; border: 0; border-radius: 6px; background: transparent; color: var(--ink); font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.iv-bar button svg { width: 17px; height: 17px; }
.iv-bar button:hover:not(:disabled) { background: #f1f3f6; }
.iv-bar button:disabled { opacity: .35; cursor: default; }
.iv-bar button.on { background: var(--blue); color: #fff; }
.iv-count { min-width: 54px; text-align: center; font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.iv-title { margin: 0 8px; min-width: 0; flex: 0 1 auto; font-size: 13px; font-weight: 600; font-family: var(--mono); color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.iv-grow { flex: 1; }
.iv-pct { width: 50px; text-align: center; font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.iv-sep { width: 1px; height: 20px; background: var(--line); margin: 0 4px; }
.iv-vp { position: relative; flex: 1; min-height: 0; overflow: hidden; background: #fff; cursor: grab; touch-action: none; user-select: none; }
.iv-vp.grabbing { cursor: grabbing; }
.iv-vp > img { position: absolute; left: 0; top: 0; max-width: none; transform-origin: 0 0; opacity: 0; }
.iv-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border-radius: 50%; border: 1px solid #c9cfd9; background: rgba(255,255,255,.95); color: var(--ink); display: grid; place-items: center; }
.iv-nav:hover { background: #f1f3f6; }
.iv-nav svg { width: 20px; height: 20px; }
.iv-nav.prev { left: 8px; }
.iv-nav.next { right: 8px; }
.iv-note { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); background: var(--navy); color: #fff; font-size: 12px; font-weight: 600; padding: 6px 12px; border-radius: 6px; }
.iv-thumbs { display: flex; gap: 8px; overflow-x: auto; padding: 8px; border-top: 1px solid var(--line); background: #f4f6f9; flex: none; }
.iv-thumbs button { width: 132px; flex: none; padding: 0; overflow: hidden; border: 2px solid var(--line); border-radius: 6px; background: #fff; text-align: left; }
.iv-thumbs button:hover { border-color: var(--blue); }
.iv-thumbs button[aria-selected="true"] { border-color: var(--orange); }
.iv-thumbs img { display: block; width: 100%; height: 76px; object-fit: contain; background: #fff; }
.iv-thumbs span { display: block; padding: 2px 6px; font-size: 11px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: #fff; }
@media (max-width: 640px) { .iv-title { display: none; } .iv-thumbs button { width: 104px; } .iv-thumbs img { height: 60px; } }

/* when something goes wrong */
.error-card { display: flex; gap: 12px; margin: 12px 0 6px; padding: 12px 14px; border: 1px solid #f5c2bd; background: #fff6f5; border-radius: 10px; color: var(--ink); }
.error-card .ec-ico { width: 32px; height: 32px; flex: none; border-radius: 8px; background: #fde4e1; color: var(--bad); display: grid; place-items: center; }
.error-card .ec-ico svg { width: 18px; height: 18px; }
.error-card.offline, .error-card.interrupted, .error-card.stalled { border-color: #f6dcae; background: #fffaf0; }
.error-card.offline .ec-ico, .error-card.interrupted .ec-ico, .error-card.stalled .ec-ico { background: #fdeccc; color: #b45309; }
.error-card .ec-text { flex: 1; min-width: 0; font-size: 14.5px; line-height: 1.5; }
.error-card .ec-text b { color: var(--navy); }
.error-card .ec-text p { margin: 3px 0 0; color: #4b5565; }
.error-card .ec-note { font-size: 13px; color: var(--muted) !important; }
.error-card .ec-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.notice { display: flex; align-items: center; gap: 8px; margin: 8px 0; padding: 7px 12px; border-radius: 8px; background: #fffaf0; border: 1px solid #f6dcae; font-size: 13.5px; color: #92400e; }
.run-note { display: flex; align-items: center; gap: 8px; margin: 8px 0 0; padding: 7px 10px; border-radius: 8px; background: #fffaf0; border: 1px solid #f6dcae; font-size: 13px; color: #92400e; }
.run-note.ok { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.spin { width: 13px; height: 13px; flex: none; border-radius: 50%; border: 2px solid currentColor; border-top-color: transparent; animation: spin .8s linear infinite; opacity: .8; }
body.offline .send { opacity: .5; }

/* header: the nlmx indicator */
.top-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.nlmx-chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border: 0; border-radius: 999px; background: #f1f3f6; color: var(--muted); font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nlmx-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: #cbd5e1; flex: none; }
.nlmx-chip.ok { background: #e8f6ee; color: #166534; }
.nlmx-chip.ok .dot { background: #16a34a; box-shadow: 0 0 0 3px rgba(22,163,74,.18); }
.nlmx-chip.old { background: #fff4e0; color: #92400e; }
.nlmx-chip.old .dot { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245,158,11,.2); }
.nlmx-chip.bad { background: #fdecea; color: var(--bad); }
.nlmx-chip.bad .dot { background: var(--bad); box-shadow: 0 0 0 3px rgba(180,35,24,.15); }
.nlmx-chip.checking .dot { background: transparent; border: 2px solid currentColor; border-top-color: transparent; width: 10px; height: 10px; animation: spin .7s linear infinite; box-shadow: none; }
.nlmx-chip:hover { filter: brightness(.97); }

/* header: the two other apps, in their own colour (teal), no border */
.top .btn.alt { background: #e3f4f1; color: #0f5f56; border: 0; font-weight: 500; }
.top .btn.alt:hover { background: #cdebe5; }

@keyframes fadeUp { from { opacity: .3; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* toast */
.toast { position: fixed; left: 50%; top: calc(var(--hdr, 51px) + 12px); transform: translateX(-50%); z-index: 70; background: var(--navy); color: #fff; font-size: 13.5px; font-weight: 500; padding: 9px 16px; border-radius: 8px; box-shadow: 0 10px 30px rgba(15,23,42,.25); max-width: calc(100vw - 32px); }
.toast.show { animation: toastIn .25s ease-out; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, -8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* files panel: the refresh button turns, then confirms */
#filesRefresh.spinning svg { animation: spin .6s linear infinite; color: var(--blue); }
#filesRefresh.done { color: var(--ok); background: #e8f6ee; }
#filesRefresh.done svg { animation: pop .4s ease-out; }
@keyframes pop { 0% { transform: scale(.6); } 60% { transform: scale(1.2); } 100% { transform: scale(1); } }

/* clear context */
.ctx-btn { display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 10px; border: 1px solid #e3e6ec; border-radius: 999px; background: #fff; color: var(--muted); font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.ctx-btn svg { width: 14px; height: 14px; }
.ctx-btn:hover:not(:disabled) { border-color: var(--orange); color: var(--orange-d); }
.author-wrap { position: relative; }
.author-btn { max-width: 230px; }
.author-btn b { font-weight: 700; color: var(--ink); overflow: hidden; text-overflow: ellipsis; max-width: 140px; }
.author-btn.custom b { color: var(--orange-d); }
body.chatting .author-wrap { display: none; } /* the start page only */
.author-pop { position: absolute; left: 0; top: calc(100% + 10px); z-index: 30; width: 310px; padding: 14px; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 10px 34px rgba(15, 23, 42, .16); text-align: left; }
.author-pop label { display: block; font-size: 12.5px; font-weight: 700; color: var(--ink); margin-bottom: 6px; }
.author-pop input { width: 100%; box-sizing: border-box; height: 38px; padding: 0 10px; border: 1px solid #d5d9e2; border-radius: 9px; font: inherit; font-size: 14.5px; color: var(--ink); outline: 0; }
.author-pop input:focus { border-color: var(--orange); box-shadow: 0 0 0 3px var(--orange-soft); }
.author-pop p { margin: 8px 0 12px; font-size: 12px; line-height: 1.45; color: var(--muted); }
.author-actions { display: flex; align-items: center; gap: 8px; }
.author-link { border: 0; background: none; padding: 4px 2px; font: inherit; font-size: 12.5px; color: var(--muted); cursor: pointer; }
.author-link:hover { color: var(--orange-d); }
.author-save { height: 32px; padding: 0 16px; border: 0; border-radius: 999px; background: var(--orange); color: #fff; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.author-save:hover { background: var(--orange-d); }
@media (max-width: 640px) { .author-pop { width: min(310px, 86vw); } .author-btn { max-width: 170px; } .author-btn b { max-width: 90px; } }
.ctx-btn:disabled { opacity: .45; cursor: default; }
.ctx-mark { display: flex; align-items: center; gap: 12px; margin: 6px 0; color: var(--muted); font-size: 12.5px; animation: fadeUp .3s ease-out; }
.ctx-mark .line { flex: 1; height: 1px; background: repeating-linear-gradient(90deg, #d5d9e1 0 6px, transparent 6px 10px); }
.ctx-mark .lbl { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.ctx-mark svg { width: 14px; height: 14px; color: var(--orange); }
.ctx-mark button { border: 0; background: transparent; color: var(--blue); font-weight: 600; font-size: 12.5px; padding: 0 0 0 6px; text-decoration: underline; }
@media (max-width: 640px) {
  .nlmx-chip { padding: 0 8px; font-size: 11.5px; }
  .ctx-mark .lbl { white-space: normal; text-align: center; }
  .ctx-btn { padding: 0 8px; }
}
body:not(.chatting) .brand-mini { display: none; }
@media (max-width: 640px) { body.chatting .brand-mini { display: none; } }

/* New: the label says "Creating…" for a moment; same size either way */
#newChat { width: 96px; justify-content: center; }
#newChat.creating svg { display: none; }
#newChat:disabled { cursor: default; opacity: .85; }

/* header: who is online */
.online-wrap { position: relative; }
.online-chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border: 0; border-radius: 999px; background: #eef2ff; color: #3730a3; font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.online-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,.2); }
.online-chip:hover, .online-chip[aria-expanded="true"] { background: #e0e7ff; }
.online-pop { position: absolute; top: calc(100% + 8px); left: 0; z-index: 40; width: 290px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 14px 40px rgba(15,23,42,.16); padding: 10px 14px 12px; font-size: 13.5px; }
.op-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid #f1f2f5; color: var(--muted); }
.op-row b { color: var(--navy); font-variant-numeric: tabular-nums; }
.op-row b small { font-weight: 500; color: var(--muted); }
.op-row.big b { font-size: 20px; }
.op-row.big span { color: var(--navy); font-weight: 600; }
.op-note { margin: 8px 0 0; font-size: 11.5px; line-height: 1.45; color: #8a93a3; }
.op-actions { display: flex; gap: 12px; margin-top: 8px; }
.op-actions button { border: 0; background: transparent; padding: 0; color: var(--blue); font-size: 12.5px; font-weight: 600; }
.op-actions button:hover { text-decoration: underline; }
@media (max-width: 640px) {
  .online-chip .txt { font-size: 0; }
  .online-chip .txt::after { content: attr(data-n); font-size: 11.5px; }
  .online-chip { padding: 0 8px; }
}
.fp-title p { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fp-title p b { color: var(--navy); font-weight: 600; font-size: 12.5px; }
#attachBtn:disabled { opacity: .35; cursor: not-allowed; }

.fp-meta .del-soon { color: var(--bad); font-weight: 600; }

/* delete a project (Files panel) and its note in the chat */
.fp-actions .fp-del { margin-left: 4px; color: var(--bad); }
.fp-actions .fp-del:hover { border-color: #f3c6c2; background: #fdecea; }
.fp-actions .zip + .fp-del { margin-left: 4px; }
.fp-confirm { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; padding: 8px 10px; border-radius: 8px; background: #fdecea; border: 1px solid #f3c6c2; font-size: 13px; color: #7f1d1d; }
.fp-confirm span { flex: 1 1 100%; }
.fp-confirm button { height: 28px; padding: 0 12px; border-radius: 6px; font-size: 13px; font-weight: 600; cursor: pointer; }
.fp-del-yes { background: var(--bad); border: 1px solid var(--bad); color: #fff; }
.fp-del-yes:disabled, .fp-del-no:disabled { opacity: .6; cursor: default; }
.fp-del-no { background: #fff; border: 1px solid #d9dce3; color: var(--navy); }
.fp-del-err { margin-top: 6px; font-size: 12.5px; color: var(--bad); }
.run.deleted { opacity: .75; }
.badge.deleted { background: #eef0f4; color: var(--muted); }
