/* Cedreon chat — loaded after app.css on /console/chat. The mono face marks
   everything GOVERNED (vault tokens, model chips, masked views); green is the
   protection signal and nothing else. Sovereign: no url(), no import. */

#chat-app { flex: 1; display: flex; min-height: 0; min-width: 0; width: 100%; }

/* -------------------------------------------------- conversations (rail) --- */
.rail-tools { padding: 2px 12px 10px; display: flex; flex-direction: column; gap: 9px; }
.rail-row { display: flex; gap: 8px; }
.rail-new { display: flex; align-items: center; justify-content: center; gap: 8px;
            flex: 1; height: 36px; background: rgba(255,255,255,.08);
            color: #fff; border: 1px solid rgba(255,255,255,.14);
            border-radius: 10px; font-size: 13px; font-weight: 600;
            cursor: pointer; font-family: var(--font-sans); }
.rail-new:hover { background: rgba(255,255,255,.14); }
.rail-folder { width: 36px; height: 36px; flex: 0 0 auto; display: grid;
               place-items: center; background: rgba(255,255,255,.08);
               color: var(--rail-ink); border: 1px solid rgba(255,255,255,.14);
               border-radius: 10px; cursor: pointer; }
.rail-folder:hover { background: rgba(255,255,255,.14); color: #fff; }
.folder-hint { padding: 6px 9px; font-size: 11px; color: var(--rail-muted); }
.rail-search { position: relative; }
.rail-search svg { position: absolute; left: 11px; top: 50%;
                   transform: translateY(-50%); color: var(--rail-muted); }
.rail-search input { width: 100%; height: 33px; padding: 0 11px 0 31px;
                     background: rgba(255,255,255,.06);
                     border: 1px solid rgba(255,255,255,.10); border-radius: 9px;
                     font-size: 12.5px; color: var(--rail-ink); }
.rail-search input:focus { border-color: rgba(255,255,255,.28);
                           box-shadow: none; background: rgba(255,255,255,.08); }
.folder-new { position: relative; }
.folder-new svg { position: absolute; left: 11px; top: 50%;
                  transform: translateY(-50%); color: var(--rail-muted); }
.folder-new input { width: 100%; height: 33px; padding: 0 11px 0 31px;
                    background: rgba(255,255,255,.10);
                    border: 1px solid rgba(255,255,255,.28); border-radius: 9px;
                    font-size: 12.5px; color: #fff; }
.folder-new input:focus { border-color: rgba(255,255,255,.45);
                          box-shadow: none; background: rgba(255,255,255,.12); }

#convo-list { padding: 0 10px 12px; }
.folder-head { display: flex; align-items: center; gap: 8px; width: 100%;
               padding: 7px 8px; margin-top: 2px; border: 0; background: none;
               border-radius: 8px; cursor: pointer; color: var(--rail-ink);
               font: inherit; text-align: left; }
.folder-head:hover { background: rgba(255,255,255,.05); }
.folder-head .chev { color: var(--rail-muted); transition: transform .15s ease; }
.folder-head[aria-expanded="true"] .chev { transform: rotate(90deg); }
.folder-head .folder-name { flex: 1; min-width: 0; font-size: 12.5px;
                            font-weight: 600; white-space: nowrap;
                            overflow: hidden; text-overflow: ellipsis; }
.folder-head .folder-count { font-family: var(--font-mono); font-size: 10px;
                             color: var(--rail-muted);
                             background: rgba(255,255,255,.06);
                             border-radius: 999px; padding: 1px 7px; }
.folder-body { margin: 1px 0 3px 12px; padding-left: 8px;
               border-left: 1px solid rgba(255,255,255,.09); }
.group-label { padding: 12px 8px 4px; }
.group-label .kicker { color: var(--rail-muted); }

.convo-item { display: flex; align-items: center; gap: 7px; width: 100%;
              border: 0; background: transparent; border-radius: 8px;
              padding: 8px 9px; cursor: pointer; color: var(--rail-ink);
              font: inherit; text-align: left; }
.convo-item:hover { background: rgba(255,255,255,.05); }
.convo-item.active { background: rgba(255,255,255,.09);
                     outline: 1px solid rgba(255,255,255,.12); }
.convo-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis;
               white-space: nowrap; font-size: 12.5px; font-weight: 500; }
.convo-item.active .convo-title { color: #fff; font-weight: 600; }
.convo-shield { display: inline-flex; align-items: center; gap: 3px;
                flex: 0 0 auto; font-family: var(--font-mono); font-size: 9.5px;
                color: #6fbf93; }
.convo-time { font-family: var(--font-mono); font-size: 9.5px;
              color: var(--rail-muted); flex: 0 0 auto; }
.convo-more { visibility: hidden; display: grid; place-items: center;
              width: 20px; height: 20px; flex: 0 0 auto; border: 0;
              border-radius: 6px; background: none; color: var(--rail-muted);
              cursor: pointer; font-size: 13px; line-height: 1; }
.convo-item:hover .convo-more, .convo-more:focus-visible { visibility: visible; }
.convo-more:hover { color: #fff; background: rgba(255,255,255,.10); }
.convo-empty { padding: 8px 10px; font-size: 12px; color: var(--rail-muted); }
.convo-rename-row { padding: 3px 4px; }
.convo-rename { width: 100%; height: 31px; padding: 0 9px;
                background: rgba(255,255,255,.08);
                border: 1px solid rgba(255,255,255,.28); border-radius: 8px;
                font: inherit; font-size: 12.5px; color: #fff;
                box-sizing: border-box; }
.convo-rename:focus { outline: none; border-color: rgba(255,255,255,.5); }

/* drag & drop into folders */
.convo-item.dragging { opacity: .45; }
.folder-head.drop-target, .folder-body.drop-target,
.ungrouped-body.drop-target, .group-label.drop-target {
  background: rgba(255,255,255,.10); border-radius: 8px;
  outline: 1px dashed rgba(255,255,255,.35); outline-offset: -1px; }
.ungrouped-body { min-height: 8px; border-radius: 8px; }

.convo-menu { position: fixed; z-index: 80; min-width: 190px;
              background: var(--surface); border: 1px solid var(--border);
              border-radius: 10px; box-shadow: var(--e2); padding: 5px; }
.convo-menu .menu-kicker { padding: 6px 9px 4px; }
.convo-menu button { display: block; width: 100%; text-align: left; border: 0;
                     background: none; border-radius: 7px; padding: 7px 9px;
                     font: inherit; font-size: 12.5px; color: var(--ink);
                     cursor: pointer; }
.convo-menu button:hover { background: var(--canvas-2); }
.convo-menu button.danger { color: var(--bad); }
.convo-menu hr { border: 0; border-top: 1px solid var(--canvas-2); margin: 4px 0; }

/* -------------------------------------------------------------- chat pane --- */
#chat-pane { flex: 1; display: flex; flex-direction: column;
             min-height: 0; min-width: 0; }
.chat-top { display: flex; align-items: center; gap: 12px; padding: 10px 20px;
            border-bottom: 1px solid var(--border); }
/* the rail collapses at any width; on phones the same button opens the drawer */
@media (min-width: 900px) {
  #chat-app[data-rail-collapsed] .rail { display: none; }
}
#sidebar-toggle { display: grid; place-items: center; width: 34px;
                  height: 34px; flex-shrink: 0; border: 0; border-radius: 9px;
                  background: none; color: var(--graphite); cursor: pointer; }
#sidebar-toggle:hover { color: var(--ink); background: rgba(28,30,34,.06); }
.chat-title { flex: 1; min-width: 0; display: flex; align-items: center;
              gap: 10px; flex-wrap: wrap; }
#chat-heading { font-size: 19px; margin: 0; white-space: nowrap;
                overflow: hidden; text-overflow: ellipsis; max-width: 48vw; }
.whoami { display: none; }

.model-card { position: relative; font-size: 12px; color: var(--faint); }
.model-card summary { cursor: pointer; list-style: none; display: grid;
                      place-items: center; width: 26px; height: 26px;
                      border-radius: 7px; }
.model-card summary:hover { color: var(--graphite);
                            background: rgba(28,30,34,.06); }
.model-card summary::-webkit-details-marker { display: none; }
.model-card[open] summary { color: var(--accent); }
.model-card .cardinfo { position: absolute; z-index: 30; top: calc(100% + 6px);
                        left: 0; width: 330px; max-width: 76vw;
                        background: var(--surface); border: 1px solid var(--border);
                        border-radius: 10px; box-shadow: var(--e2);
                        padding: 10px 12px; line-height: 1.55; color: var(--ink); }

.vault-pill { display: inline-flex; align-items: center; gap: 6px;
              padding: 5px 12px; border: 0; border-radius: 999px;
              background: rgba(47,106,74,.10); color: var(--ok);
              font-size: 11.5px; font-weight: 600; cursor: pointer;
              white-space: nowrap; font-family: var(--font-sans); }
.vault-pill:hover { background: rgba(47,106,74,.16); }
.vault-pill .dot { width: 6px; height: 6px; border-radius: 50%;
                   background: var(--ok); }

/* messages column: readable measure inside the flexible pane */
#msgs { flex: 1; overflow-y: auto; padding: 20px 22px 6px; }
#msgs > * { max-width: 780px; margin-left: auto; margin-right: auto; }

#empty-state { text-align: center; margin-top: 26vh; }
.empty-line { font-family: var(--font-display); font-size: 25px;
              font-weight: 600; color: var(--ink-2); margin: 0; }

/* ------------------------------------------------------------------ turns --- */
.turn { display: flex; gap: 11px; margin-bottom: 18px; }
.turn-avatar { width: 28px; height: 28px; flex: 0 0 auto; border-radius: 8px;
               display: grid; place-items: center; margin-top: 2px;
               font-size: 10.5px; font-weight: 700; }
.turn.you .turn-avatar { background: #e8e3d7; color: #6b6152; }
.turn.ai .turn-avatar { background: var(--rail); color: #8fd0ac; }
.turn-main { flex: 1; min-width: 0; }
.turn-head { display: flex; align-items: center; gap: 9px; margin-bottom: 5px; }
.turn-author { font-size: 13px; font-weight: 600; }
.turn-time { font-family: var(--font-mono); font-size: 10.5px; color: var(--faint); }
.turn-vaulted { display: inline-flex; align-items: center; gap: 4px;
                font-family: var(--font-mono); font-size: 10.5px;
                font-weight: 500; color: var(--ok); }

.turn-card { font-size: 14px; line-height: 1.6; color: var(--ink);
             border: 1px solid var(--border); border-radius: 12px;
             box-shadow: var(--e1); padding: 11px 14px; min-width: 0;
             overflow-wrap: break-word; }
.turn.you .turn-card { background: var(--paper); white-space: pre-wrap; }
.turn.ai .turn-card { background: var(--surface);
                      border-bottom-left-radius: 4px; }
.turn.ai .turn-card.blocked { border-color: rgba(166,61,64,.35);
                              background: rgba(166,61,64,.04); }
.turn.ai .turn-card.error { border-color: rgba(166,61,64,.35);
                            color: var(--bad); }

/* Inline vault marks in the user's sent message. */
mark.vault-hit { background: rgba(47,106,74,.10); color: var(--ok-ink);
                 border-bottom: 1px solid rgba(47,106,74,.45);
                 border-radius: 3px; padding: 0 2px; }
.tok-chip { font-family: var(--font-mono); font-size: 12.5px;
            background: rgba(47,61,89,.08); color: var(--accent);
            border: 1px solid rgba(47,61,89,.20); border-radius: 5px;
            padding: 0 5px; white-space: nowrap; }

.attach-tag { display: inline-flex; align-items: center; gap: 6px;
              font-family: var(--font-mono); font-size: 11px;
              background: rgba(28,30,34,.05); border: 1px solid var(--border);
              border-radius: 7px; padding: 3px 8px; margin: 0 6px 6px 0; }

/* per-turn footer rows */
.turn-meta { display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
             font-size: 11px; color: var(--graphite); margin-top: 6px; }
.masked-toggle { border: 0; background: none; cursor: pointer; padding: 0;
                 display: inline-flex; align-items: center; gap: 5px;
                 font-family: var(--font-mono); font-size: 10.5px;
                 color: var(--ok); font-weight: 600; }
.masked-toggle:hover { text-decoration: underline; }
.masked-fallback { font-family: var(--font-mono); font-size: 12px;
                   line-height: 1.6; white-space: pre-wrap;
                   word-break: break-word;
                   background: rgba(47,106,74,.05);
                   border: 1px solid rgba(47,106,74,.25);
                   border-radius: 10px; padding: 9px 12px; margin-top: 7px;
                   color: var(--ink); }
.masked-fallback .cap { display: block; margin-bottom: 4px; }
.model-chip { font-family: var(--font-mono); font-size: 10.5px;
              background: rgba(28,30,34,.06); border-radius: 999px;
              padding: 2px 9px; color: var(--ink); }
.vault-note { font-family: var(--font-mono); font-size: 10.5px; color: var(--ok); }
.usage-note { font-family: var(--font-mono); font-size: 10.5px; }
.open-doc-btn { border: 1px solid var(--border-2); background: var(--surface);
                color: var(--accent); border-radius: 7px; font-size: 11px;
                font-weight: 600; padding: 3px 10px; cursor: pointer; }
.open-doc-btn:hover { border-color: var(--accent); }

/* thinking indicator (replies are screened whole — never token streaming) */
.dots { display: inline-flex; gap: 4px; padding: 8px 2px; }
.dots span { width: 6px; height: 6px; border-radius: 50%;
             background: var(--graphite); opacity: .4;
             animation: cd-pulse 1s infinite ease-in-out; }
.dots span:nth-child(2) { animation-delay: .15s; }
.dots span:nth-child(3) { animation-delay: .3s; }
@keyframes cd-pulse {
  0%, 80%, 100% { transform: scale(.6); opacity: .35; }
  40% { transform: scale(1); opacity: 1; } }

/* --------------------------------------------------------------- markdown --- */
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md h1, .md h2, .md h3, .md h4 { font-family: var(--font-display);
                                 font-weight: 650; margin: 14px 0 6px;
                                 line-height: 1.3; }
.md h1 { font-size: 19px; } .md h2 { font-size: 17px; }
.md h3 { font-size: 15px; } .md h4 { font-size: 14px; }
.md p { margin: 8px 0; }
.md ul, .md ol { margin: 8px 0; padding-left: 22px; }
.md li { margin: 3px 0; }
.md blockquote { border-left: 3px solid var(--border-2); margin: 8px 0;
                 padding: 2px 0 2px 12px; color: var(--graphite); }
.md hr { border: 0; border-top: 1px solid var(--border); margin: 14px 0; }
.md code { font-family: var(--font-mono); font-size: 12.5px;
           background: rgba(28,30,34,.06); border-radius: 5px; padding: 1px 5px; }
.md a { color: var(--accent); }

.codeblock { border: 1px solid var(--border); border-radius: 10px;
             overflow: hidden; margin: 10px 0; }
.codeblock-head { display: flex; align-items: center; gap: 8px;
                  padding: 4px 6px 4px 12px; background: var(--canvas-2);
                  border-bottom: 1px solid var(--border); }
.codeblock-lang { font-family: var(--font-mono); font-size: 10.5px;
                  letter-spacing: .05em; color: var(--graphite); flex: 1;
                  text-transform: lowercase; }
.codeblock pre { margin: 0; padding: 12px 14px; overflow-x: auto;
                 background: var(--rail); }
.codeblock code { font-family: var(--font-mono); font-size: 12.5px;
                  line-height: 1.55; color: #dbe4f0; background: none;
                  padding: 0; white-space: pre; }
.table-scroll { overflow-x: auto; border: 1px solid var(--border);
                border-radius: 10px; margin: 10px 0; }
.table-scroll table { margin: 0; }
.table-scroll td, .table-scroll th { padding: 7px 12px; }

/* ---------------------------------------------------------------- composer --- */
#composer { padding: 6px 22px 14px; }
#composer > * { max-width: 780px; margin-left: auto; margin-right: auto; }
#deny-warning { display: flex; align-items: center; gap: 8px;
                background: var(--bad-tint);
                border: 1px solid rgba(166,61,64,.35); color: var(--bad);
                border-radius: 10px; padding: 8px 12px; margin-bottom: 8px;
                font-size: 12.5px; font-weight: 500; }
#attach-chips { display: flex; flex-wrap: wrap; gap: 6px; }
#attach-chips:not(:empty) { margin-bottom: 8px; }
.attach-chip { display: inline-flex; align-items: center; gap: 7px;
               font-family: var(--font-mono); font-size: 11.5px;
               background: rgba(28,30,34,.04); border: 1px solid var(--border);
               border-radius: 8px; padding: 4px 6px 4px 9px; }
.attach-chip.bad { color: var(--bad); border-color: rgba(166,61,64,.35);
                   background: var(--bad-tint); }
.attach-chip .size { color: var(--faint); }
.attach-chip button { border: 0; background: none; cursor: pointer;
                      color: var(--faint); font-size: 12px; line-height: 1;
                      padding: 1px 3px; border-radius: 5px; }
.attach-chip button:hover { color: var(--bad); }

.composer-box { border: 1.5px solid var(--border-2); border-radius: 14px;
                background: var(--surface); padding: 11px 12px 9px;
                box-shadow: var(--e1);
                transition: border-color .15s ease, box-shadow .15s ease; }
.composer-box:focus-within { border-color: var(--accent);
                             box-shadow: 0 0 0 3px rgba(47,61,89,.12); }
#composer.drop-active .composer-box { border-color: var(--accent);
                                       background: rgba(47,61,89,.06); }
#input { display: block; width: 100%; border: 0; outline: none; resize: none;
         background: transparent; font: inherit; font-size: 14.5px;
         line-height: 1.5; padding: 0 2px; max-height: 200px; color: var(--ink);
         box-shadow: none; }
.composer-row { display: flex; align-items: center; gap: 8px; margin-top: 9px; }
.spacer { flex: 1; }

.model-wrap { position: relative; }
#model-trigger { display: flex; align-items: center; gap: 7px; height: 32px;
                 padding: 0 11px; border-radius: 8px;
                 border: 1px solid var(--border-2); background: var(--surface);
                 color: var(--ink-2); cursor: pointer; font-size: 12.5px;
                 font-weight: 500; font-family: var(--font-sans); }
#model-trigger:hover { border-color: var(--graphite); }
#model-menu { position: absolute; bottom: 40px; left: 0; z-index: 50;
              width: 300px; background: var(--surface);
              border: 1px solid var(--border); border-radius: 12px;
              box-shadow: var(--e2); padding: 6px; }
.menu-kicker { font-family: var(--font-mono); font-size: 10px;
               letter-spacing: .07em; text-transform: uppercase;
               color: var(--faint); padding: 7px 9px 5px; }
#model-menu [role="option"] { display: block; width: 100%; text-align: left;
                              border: 0; background: none; border-radius: 8px;
                              padding: 8px 9px; cursor: pointer; font: inherit; }
#model-menu [role="option"]:hover, #model-menu [role="option"].focused
              { background: var(--canvas); }
#model-menu [role="option"][aria-selected="true"] { background: var(--canvas-2); }
.opt-name { display: block; font-size: 13px; font-weight: 600; color: var(--ink); }
.opt-name em { font-style: normal; font-family: var(--font-mono);
               font-size: 9.5px; font-weight: 600; letter-spacing: .05em;
               border-radius: 999px; padding: 1px 7px; margin-left: 6px;
               vertical-align: 1px; }
.opt-name em.ok { background: rgba(47,106,74,.10); color: var(--ok); }
.opt-desc { display: block; font-size: 11.5px; color: var(--graphite);
            margin-top: 1px; }

.count-pill { display: inline-flex; align-items: center; gap: 6px; height: 32px;
              padding: 0 12px; border-radius: 8px; border: 1px solid rgba(47,106,74,.25);
              background: rgba(47,106,74,.09); color: var(--ok);
              font-family: var(--font-mono); font-size: 11.5px; font-weight: 600;
              cursor: pointer; white-space: nowrap; }
.count-pill:hover { background: rgba(47,106,74,.15); }
.count-pill.deny { border-color: rgba(166,61,64,.35);
                   background: var(--bad-tint); color: var(--bad); }
.send-btn { width: 36px; height: 36px; flex: 0 0 auto; display: grid;
            place-items: center; border: 0; border-radius: 10px;
            background: var(--accent); color: #fff; cursor: pointer; }
.send-btn:hover { background: var(--accent-strong); }
.send-btn:disabled { background: var(--border-2); color: var(--canvas);
                     cursor: default; }
.composer-note { text-align: center; font-family: var(--font-mono);
                 font-size: 10px; color: var(--faint); margin-top: 8px; }

/* --------------------------------------------------------------- side pane --- */
#side-pane { width: var(--pane-w, 384px); flex: 0 0 var(--pane-w, 384px);
             display: flex; position: relative;
             flex-direction: column; min-height: 0; min-width: 0;
             background: var(--canvas-2); border-left: 1px solid var(--border); }
.pane-resizer { position: absolute; left: -4px; top: 0; bottom: 0; width: 8px;
                cursor: col-resize; z-index: 5; }
.pane-resizer:hover, .pane-resizer.active { background: rgba(47,61,89,.18); }
#side-pane[hidden] { display: none; }
.pane-top { display: flex; align-items: center; gap: 4px;
            padding: 10px 12px; border-bottom: 1px solid var(--border); }
.pane-tabs { display: flex; gap: 4px; flex: 1; }
.pane-tabs [role="tab"] { display: inline-flex; align-items: center; gap: 6px;
                          height: 33px; padding: 0 13px; border: 1px solid transparent;
                          border-radius: 8px; background: transparent;
                          color: var(--faint); font-size: 13px; font-weight: 500;
                          cursor: pointer; font-family: var(--font-sans); }
.pane-tabs [role="tab"][aria-selected="true"] { background: var(--surface);
                          color: var(--ink); border-color: var(--border);
                          box-shadow: var(--e1); }
.tab-count { font-family: var(--font-mono); font-size: 10.5px; font-weight: 700;
             background: rgba(47,106,74,.14); color: var(--ok);
             border-radius: 999px; padding: 0 6px; min-width: 16px;
             text-align: center; }
.pane-body { flex: 1; overflow-y: auto; min-height: 0; padding: 14px; }

/* Vault tab */
.vault-intro { display: flex; gap: 11px; padding: 13px 14px;
               background: var(--surface); border: 1px solid var(--border);
               border-radius: 12px; }
.vault-icon { width: 30px; height: 30px; flex: 0 0 auto; border-radius: 8px;
              background: rgba(47,106,74,.10); color: var(--ok);
              display: grid; place-items: center; }
.vault-intro-title { font-family: var(--font-display); font-weight: 650;
                     font-size: 15px; }
.vault-intro-sub { font-size: 12.5px; color: var(--ink-2); line-height: 1.5;
                   margin-top: 2px; }
.vault-live-head { display: flex; align-items: center;
                   justify-content: space-between; margin: 18px 4px 9px; }
.count-badge { font-family: var(--font-mono); font-size: 11px; font-weight: 600;
               padding: 2px 9px; border-radius: 999px;
               background: rgba(28,30,34,.06); color: var(--graphite); }
.count-badge.live { background: rgba(47,106,74,.12); color: var(--ok); }
#vault-list { display: flex; flex-direction: column; gap: 8px; }
.vault-row { display: flex; align-items: center; gap: 11px; padding: 10px 12px;
             background: var(--surface); border: 1px solid var(--border);
             border-radius: 10px; }
.vault-row .vault-icon { width: 28px; height: 28px; }
.vault-row-main { flex: 1; min-width: 0; }
.vault-row-top { display: flex; align-items: center; gap: 7px; }
.vault-type { font-size: 12.5px; font-weight: 600; }
.vault-masked { font-family: var(--font-mono); font-size: 11.5px;
                color: var(--faint); white-space: nowrap; overflow: hidden;
                text-overflow: ellipsis; }
.vault-row-sub { display: flex; align-items: center; gap: 6px; margin-top: 3px;
                 font-size: 11px; color: var(--graphite); }
.vault-empty { display: flex; flex-direction: column; align-items: center;
               text-align: center; gap: 8px; padding: 24px 16px;
               background: var(--paper); border: 1px dashed var(--border-2);
               border-radius: 12px; color: var(--faint); }
.vault-empty b { font-size: 13px; color: var(--graphite); }
.vault-empty span { font-size: 12px; line-height: 1.5; max-width: 240px; }
.vault-deny { display: flex; gap: 9px; margin-top: 10px; padding: 11px 13px;
              background: var(--bad-tint); border: 1px solid rgba(166,61,64,.35);
              border-radius: 10px; font-size: 12px; color: var(--bad);
              line-height: 1.5; }
.vault-screened { margin: 20px 4px 8px; }
.screened-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.screened-chip { font-family: var(--font-mono); font-size: 10.5px;
                 color: var(--ink-2); background: var(--surface);
                 border: 1px solid var(--border); border-radius: 999px;
                 padding: 3px 10px; }
.screened-chip.ner { color: var(--layer2); border-color: rgba(91,75,138,.30); }
.vault-note-card { display: flex; gap: 9px; margin-top: 16px; padding: 11px 13px;
                   background: rgba(47,106,74,.08);
                   border: 1px solid rgba(47,106,74,.22); border-radius: 10px;
                   font-size: 12px; color: var(--ok-ink); line-height: 1.5; }

/* Document tab */
.doc-card { background: var(--surface); border: 1px solid var(--border);
            border-radius: 12px; display: flex; flex-direction: column;
            min-height: 0; height: 100%; overflow: hidden; }
#doc-view { display: flex; flex-direction: column; min-height: 0; }
#doc-view[hidden] { display: none; }
.doc-head { display: flex; align-items: center; gap: 8px;
            padding: 11px 13px; border-bottom: 1px solid var(--canvas-2); }
.doc-title { font-family: var(--font-display); font-weight: 650; font-size: 15px;
             flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis;
             white-space: nowrap; }
.doc-tabs { display: flex; gap: 2px; border-radius: 8px; padding: 2px;
            background: var(--canvas-2); }
.doc-tabs button { border: 0; background: transparent; font-size: 11.5px;
                   font-weight: 600; padding: 3px 10px; border-radius: 6px;
                   color: var(--graphite); cursor: pointer;
                   font-family: var(--font-sans); }
.doc-tabs button.active { background: var(--surface); color: var(--ink);
                          box-shadow: var(--e1); }
#doc-body { flex: 1; overflow: auto; min-height: 0; padding: 13px 15px;
            font-size: 13.5px; }
#doc-body pre.src { margin: 0; font-family: var(--font-mono); font-size: 12px;
                    line-height: 1.6; white-space: pre-wrap;
                    word-break: break-word; }
#doc-body textarea.doc-edit { width: 100%; height: 100%; min-height: 260px;
                    border: 0; padding: 0; resize: none; background: none;
                    font-family: var(--font-display); font-size: 13.5px;
                    line-height: 1.7; color: var(--ink-2); box-shadow: none; }
.doc-foot { display: flex; align-items: center; gap: 8px; padding: 9px 12px;
            border-top: 1px solid var(--canvas-2); background: var(--paper); }
.doc-meta { font-family: var(--font-mono); font-size: 10.5px; color: var(--faint); }

/* ------------------------------------------------------------ auth overlay --- */
.auth-overlay { position: fixed; inset: 0; z-index: 90; display: grid;
                place-items: center; background: rgba(28,30,34,.45);
                backdrop-filter: blur(7px); -webkit-backdrop-filter: blur(7px); }
.auth-card { position: relative; width: 420px; max-width: 92vw;
             max-height: 92vh; overflow-y: auto;
             background: var(--surface); border-radius: 18px;
             box-shadow: var(--e3); padding: 30px 28px 20px; }
.auth-close { position: absolute; top: 12px; left: 12px; width: 32px; height: 32px;
              display: grid; place-items: center; border: 0; border-radius: 9px;
              background: transparent; color: var(--faint); cursor: pointer; }
.auth-close:hover { background: var(--canvas-2); color: var(--ink-2); }
.auth-close:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.auth-brand { display: flex; flex-direction: column; align-items: center;
              gap: 9px; margin-bottom: 16px; text-align: center; }
.auth-mark { width: 46px; height: 46px; border-radius: 13px; background: var(--rail);
             color: var(--canvas); display: grid; place-items: center; }
.auth-name { font-family: var(--font-display); font-weight: 650; font-size: 23px;
             line-height: 1; }
.auth-tag { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .14em;
            text-transform: uppercase; color: var(--faint); }
.auth-note { margin: 0 0 14px; padding: 9px 12px; border-radius: 9px;
             background: var(--warn-tint); color: var(--warn); font-size: 12.5px;
             font-weight: 600; text-align: center; }
.auth-foot { margin: 16px 0 0; text-align: center; font-family: var(--font-mono);
             font-size: 10px; letter-spacing: .05em; color: var(--faint); }
/* The free-trial wall reuses the auth card, but is a distinct overlay (never
   the sign-in surface) so signed-in pages carry no `auth-overlay`. */
.wall-overlay { position: fixed; inset: 0; z-index: 90; display: grid;
                place-items: center; background: rgba(28,30,34,.45);
                backdrop-filter: blur(7px); -webkit-backdrop-filter: blur(7px); }
.wall-actions { display: flex; flex-direction: column; gap: 8px; }
.wall-actions .btn { width: 100%; padding: 11px; }
.auth-tabs { display: flex; gap: 4px; background: var(--canvas-2);
             border-radius: 10px; padding: 3px; margin-bottom: 16px; }
.auth-tabs label { flex: 1; text-align: center; padding: 8px 6px;
                   border-radius: 8px; font-size: 13px; font-weight: 600;
                   color: var(--graphite); cursor: pointer; }
#auth-in:checked ~ .auth-tabs label[for="auth-in"],
#auth-up:checked ~ .auth-tabs label[for="auth-up"] {
  background: var(--surface); color: var(--ink); box-shadow: var(--e1); }
.auth-form { display: none; }
#auth-in:checked ~ .auth-form-in { display: block; }
#auth-up:checked ~ .auth-form-up { display: block; }
.auth-form label { margin-top: 12px; }
.auth-form .btn { width: 100%; margin-top: 18px; padding: 11px; }
.auth-error { margin: 0 0 14px; padding: 9px 12px; border-radius: 9px;
              background: var(--bad-tint); color: var(--bad); font-size: 12.5px;
              font-weight: 600; text-align: center; }
.auth-extra { margin-top: 14px; }
.auth-extra summary { list-style: none; cursor: pointer; user-select: none;
                      font-size: 12px; color: var(--graphite); font-weight: 600; }
.auth-extra summary::-webkit-details-marker { display: none; }
.auth-extra summary::before { content: "›"; display: inline-block;
                              margin-right: 6px; transition: transform .15s ease; }
.auth-extra[open] summary::before { transform: rotate(90deg); }

/* -------------------------------------------------------------- responsive --- */
@media (max-width: 1199px) {
  /* the panel takes priority over the rail at mid widths */
  #chat-app[data-pane-open] .rail { display: none; }
}
@media (max-width: 899px) {
  .rail { position: fixed; top: 0; bottom: 0; left: 0; z-index: 60;
          box-shadow: var(--e3); transform: translateX(-105%);
          transition: transform .2s ease; display: flex; }
  #chat-app[data-sidebar-open] .rail { transform: none; }
  #chat-app[data-sidebar-open] #scrim { display: block; position: fixed;
    inset: 0; z-index: 50; background: rgba(28,30,34,.4); }
  #side-pane { position: fixed; inset: 0; z-index: 70; width: auto;
               flex-basis: auto; }
  .pane-resizer { display: none; }
  .vault-pill span + span { display: none; }
  #chat-heading { max-width: none; }
  .chat-title .model-card .cardinfo { left: auto; right: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .dots span { animation: none; }
  .rail { transition: none; }
  .composer-box { transition: none; }
}
