/* KPNet, design D ("Desk"): quiet grey sidebar, one centred column, the composer is the hero.
   K+P blue only for primary buttons, focus, links, activity and the logo; status lights use red, amber and green.
   Type (README 2.1): one face, Segoe UI, code in Cascadia Mono; five sizes and two weights, used only through the
   tokens below. Bold is Segoe's real semibold. Copy keeps the KP email font (chat.js). Text size (core.js) zooms all of it. */
:root {
  --font: "Segoe UI", sans-serif; --mono: "Cascadia Mono", Consolas, monospace;
  --fs-display: 26px; --fs-heading: 17px; --fs-body: 15px; --fs-small: 13px; --fs-code: 13px;
  --fw-normal: 400; --fw-bold: 600;
  --kp: #005E9D; --kp-dark: #004F86; --kp-wash: rgba(0, 94, 157, .07); --kp-wash-on: rgba(0, 94, 157, .13);
  --side: #F4F6F8; --hover: #E9EDF1; --on: #E2E8ED;
  --ink: #1D2833; --mute: #56616B; --rule: #E2E7EB;
  --amber: #E0A100; --red: #B42318; --red-dark: #912018; --tick: #2E7A4B; --ring: #C3CBD2;
  --col: 768px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { display: grid; grid-template-columns: 280px 1fr; overflow: hidden; color: var(--ink); background: #fff;
       font: var(--fw-normal) var(--fs-body)/1.55 var(--font); }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
b, strong, h1, h2, h3, h4, h5, h6 { font-weight: var(--fw-bold); }
img { -webkit-user-drag: none; }   /* a logo inside a platform tile must not start an image drag of its own */
button:disabled { cursor: default; opacity: .5; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--kp); outline-offset: 2px; }
textarea { resize: none; }

.primary { background: var(--kp); color: #fff; border: 0; border-radius: 10px; padding: 8px 18px; font-weight: var(--fw-bold); }
.primary:hover:not(:disabled) { background: var(--kp-dark); }
.ghost { background: none; border: 1px solid var(--rule); border-radius: 8px; padding: 5px 12px; font-size: var(--fs-body); }
.ghost:hover:not(:disabled) { background: var(--side); }

/* Sidebar */
body.pop { grid-template-columns: 1fr; }   /* its own window: the conversation alone (README 3.11) */
body.pop .side { display: none; }
.side { display: flex; flex-direction: column; gap: 10px; min-height: 0; padding: 18px 12px 14px; background: var(--side); }
.brand { width: 210px; max-width: calc(100% - 12px); align-self: flex-start; margin: 6px 6px 12px; }
.new { text-align: left; padding: 9px 12px; background: #fff; border: 1px solid var(--rule); border-radius: 10px; }
.new::before { content: "+"; color: var(--kp); font-weight: var(--fw-bold); margin-right: 8px; }
.search { padding: 8px 12px; border: 1px solid transparent; border-radius: 8px; background: transparent; }
.search:focus { background: #fff; border-color: var(--rule); outline: none; }
.convos { flex: 1; min-height: 0; overflow-y: auto; margin: 0 -4px; padding: 0 4px; user-select: none; }
.convos h4 { margin: 14px 8px 4px; font-size: var(--fs-small); font-weight: var(--fw-normal); color: var(--mute); }
.convo { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 8px; border: 0; border-radius: 8px; background: none; text-align: left; cursor: pointer; }
.convo:hover, .convo:focus-within { background: var(--hover); }
.convo.unread .t { font-weight: var(--fw-bold); }
.convo .more, .folder .more { display: none; width: 24px; height: 24px; margin: -4px -2px -4px -6px; padding: 0; border: 0; border-radius: 6px; background: none; color: var(--mute); font-size: var(--fs-heading); line-height: 1; }
.convo .more:hover, .folder .more:hover { background: var(--on); color: var(--ink); }
.convo:hover .more, .convo:focus-within .more, .folder:hover .more, .folder:focus-within .more { display: block; }
.convo .rename, .folder .rename { flex: 1; min-width: 0; padding: 1px 4px; margin: -2px -5px; border: 1px solid var(--kp); border-radius: 6px; background: #fff; outline: none; }
.convo.on { background: var(--on); }
.convo .tx { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.convo .t, .convo .c { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.convo .c { font-size: var(--fs-small); color: var(--mute); }
.folder { display: flex; align-items: center; gap: 6px; margin-top: 10px; padding: 4px 8px; border-radius: 8px; font-size: var(--fs-small); color: var(--mute); cursor: pointer; }
.folder:hover, .folder:focus-within, .folder.over { background: var(--hover); }
.folder .t { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.folder .chev::before { content: "\203A"; display: block; font-style: normal; font-size: var(--fs-body); line-height: 1; }
.folder[aria-expanded="true"] .chev::before { transform: rotate(90deg); }
body.sorting #convos > * { transition: transform .15s; }   /* the others slide aside while a row or folder is dragged (as the rail's cards) */
body.sorting #convos > .moving { position: relative; z-index: 2; background: #fff; box-shadow: 0 6px 20px rgba(29, 40, 51, .16); transition: none; }   /* follows the pointer */
.pinslot { margin: 14px 0 4px; padding: 7px 8px; border: 1px dashed var(--ring); border-radius: 8px; font-size: var(--fs-small); color: var(--mute); }
body.sorting, body.sorting * { cursor: grabbing !important; }
.light { width: 18px; height: 18px; flex: none; display: grid; place-items: center; }
.light::before { content: ""; width: 10px; height: 10px; border-radius: 50%; }
.light.red::before { background: var(--red); }
.light.amber::before { background: var(--amber); animation: pulse 1.2s ease-in-out infinite; }
.light.green::before { background: var(--tick); }
.light.off::before { box-shadow: inset 0 0 0 1.5px var(--ring); }
.showarch { margin: 10px 8px 4px; padding: 0; border: 0; background: none; font-size: var(--fs-small); color: var(--mute); }
.showarch:hover { color: var(--ink); text-decoration: underline; }
#newfolder { align-self: flex-start; margin: 0 8px; }
.menu { position: fixed; z-index: 10; min-width: 168px; padding: 4px; background: #fff; border: 1px solid var(--rule); border-radius: 10px;
        box-shadow: 0 6px 20px rgba(29, 40, 51, .14); max-width: min(320px, calc(100vw - 16px)); }
.menu button { display: block; width: 100%; padding: 6px 10px; border: 0; border-radius: 6px; background: none; text-align: left; }
.menu button:hover, .menu button:focus { background: var(--side); outline: none; }
.menu .danger { color: var(--red); }
.menu hr { margin: 4px 2px; border: 0; border-top: 1px solid var(--rule); }
.scrim { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; background: rgba(29, 40, 51, .28); }
.dialog { width: min(420px, calc(100vw - 32px)); padding: 20px 22px 18px; background: #fff; border-radius: 14px; box-shadow: 0 12px 40px rgba(29, 40, 51, .22); }
.dialog h3 { margin: 0 0 6px; font-size: var(--fs-heading); font-weight: var(--fw-bold); }
.dialog p { margin: 0 0 18px; color: var(--mute); white-space: pre-wrap; word-break: break-word; }
.dialog .buttons { display: flex; justify-content: flex-end; gap: 8px; }
.primary.danger { background: var(--red); }
.primary.danger:hover:not(:disabled) { background: var(--red-dark); }
.toast { position: fixed; z-index: 10; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; align-items: center; gap: 14px;
         padding: 8px 10px 8px 16px; background: var(--ink); color: #fff; border-radius: 10px; font-size: var(--fs-body); box-shadow: 0 6px 20px rgba(29, 40, 51, .2); }
.toast button { border: 0; background: none; color: #fff; font-weight: var(--fw-bold); padding: 3px 8px; border-radius: 6px; }
.toast button:hover { background: rgba(255, 255, 255, .14); }
.empty { margin: 14px 8px; font-size: var(--fs-small); color: var(--mute); }
.me { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 8px; margin: 0 -4px; padding: 8px 4px 0; border-top: 1px solid var(--rule);
      font-size: var(--fs-small); color: var(--mute); }   /* the person, below a rule that ends the list */
.me b { font-size: var(--fs-body); color: var(--ink); font-weight: var(--fw-bold); }
.who { display: flex; flex-direction: column; min-width: 0; padding: 6px 8px; border: 0; border-radius: 8px; background: none; text-align: left; color: inherit; }
.who:hover { background: var(--hover); }
.who b, .who span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me .showarch { margin: 0; }
.me .textsize { margin-bottom: 6px; padding-right: 8px; white-space: nowrap; }   /* level with the office line */
.menu button.on::after { content: "\2713"; float: right; margin-left: 16px; color: var(--kp); }   /* the size in use */
.menu .hint { margin: 4px 10px 6px; font-size: var(--fs-small); color: var(--mute); overflow-wrap: anywhere; }   /* a long email wraps */
.menu.account button { font-size: var(--fs-small); }   /* Sign out at the size of the account line above it */

/* Icons */
.ic { width: 18px; height: 18px; object-fit: contain; flex: none; border-radius: 4px; }
.mono { display: inline-grid; place-items: center; width: 18px; height: 18px; flex: none; border-radius: 4px;
        background: var(--on); color: var(--mute); font-size: 9px; font-weight: var(--fw-bold); }
.logo { height: 20px; max-width: 72px; object-fit: contain; }

/* Main */
main { min-height: 0; overflow: hidden; display: grid; }
main > section { min-height: 0; overflow-y: auto; }

.gate { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 18px; }
.gate img { width: 64px; }
.gate p { margin: 0; font-size: var(--fs-heading); max-width: 44ch; }
.gate ol { margin: 0; padding-left: 20px; max-width: 52ch; text-align: left; line-height: 1.6; }

.home { display: grid; grid-template-rows: 1fr auto auto; overflow: hidden !important; }   /* the message box and reminder are a conversation's (.composer, .caution): the same place */
.homemain { min-height: 0; overflow-y: auto; display: flex; flex-direction: column; align-items: center; justify-content: safe center; padding: 32px; }   /* centred between the top and the box; scrolls when it does not fit */
.homemain > * { width: 100%; max-width: var(--col); }
.home h1 { display: flex; flex-direction: column; align-items: center; gap: 12px; margin: 0 0 40px; }   /* the Ned AI logo, mark above words */
.home h1 img:first-child { height: 64px; } .home h1 img:last-child { height: 34px; }
@media (max-height: 840px) { .home h1 { gap: 8px; margin-bottom: 28px; } .home h1 img:first-child { height: 48px; } .home h1 img:last-child { height: 26px; } }   /* a laptop shows the whole list */
.lines { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }   /* what Ned produces (the slides' four cards) */
.tile.line { display: flex; flex-direction: column; align-items: flex-start; padding: 12px 14px; border: 0;
             border-radius: 8px; background: var(--kp-wash); text-align: left; }   /* .tile.line: the tile rule below must not strip the card's wash */
.tile.line:hover { background: var(--kp-wash-on); }
.line h3 { margin: 0; font-size: var(--fs-body); font-weight: var(--fw-bold); color: var(--kp); }
.stages { margin-top: 32px; border-top: 1px solid var(--rule); padding-top: 12px; }
.stage { display: grid; grid-template-columns: 130px 1fr; align-items: start; gap: 14px; padding: 5px 0; }
.stage h3 { margin: 0; padding-top: 8px; font-size: var(--fs-small); font-weight: var(--fw-bold); color: var(--mute); }   /* level with the first row of tiles when they wrap */
.tiles { display: flex; flex-wrap: wrap; gap: 6px; }
.tile { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 8px; border: 0; border-radius: 10px; background: none; font-weight: var(--fw-bold); }
.tile:hover { background: var(--side); }
.other .tile { padding-left: 12px; }
.tile[draggable="true"] { cursor: grab; }
.stagenote { margin: 0 0 8px; font-size: var(--fs-small); color: var(--mute); }
body.dragging [data-drop] { outline: 2px dashed var(--kp); outline-offset: 2px; }   /* where a drag can be let go */
[data-drop].over { outline-style: solid; background: var(--kp-wash); }
.attached { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 6px 0; }
.attached:empty { display: none; }
.pics { display: flex; flex-wrap: wrap; gap: 10px; padding: 6px 6px 0; }   /* pasted screenshots waiting to go (paste.js) */
.pics:empty { display: none; }
.pic { position: relative; display: inline-block; }
.pic canvas { display: block; width: 64px; height: 64px; object-fit: cover; object-position: top left; border: 1px solid var(--rule); border-radius: 8px; background: #fff; }   /* the top left: a screen's title and headers, so the tile says which screen */
.pic button { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; padding: 0; border: 1px solid var(--rule); border-radius: 50%; background: #fff; color: var(--mute); line-height: 1; }
.pic button:hover { color: var(--ink); }
.you .pics { justify-content: flex-end; padding: 0 0 4px; background: none; border-radius: 0; max-width: 420px; }   /* not a bubble (.you div); four squares a row */
.you .pic canvas { width: 96px; height: 96px; cursor: zoom-in; }
.you .pics.one .pic canvas { width: auto; height: auto; max-width: 320px; max-height: 240px; object-fit: contain; }   /* one screenshot keeps its shape */
.viewer canvas { max-width: 92vw; max-height: 90vh; border-radius: 8px; background: #fff; box-shadow: 0 12px 40px rgba(29, 40, 51, .22); }   /* a screenshot opened full size */
.you .shot { padding: 4px 10px; border-radius: 8px; background: var(--side); font-size: var(--fs-small); color: var(--mute); }   /* a screenshot in a reopened conversation */
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 8px; border-radius: 8px; background: var(--side); font-size: var(--fs-small); }
.tag button { border: 0; background: none; color: var(--mute); padding: 0 4px; border-radius: 4px; }
.tag button:hover { background: var(--hover); color: var(--ink); }

/* Platform introduction */
.introskill { margin: 22px 0 0; padding-top: 16px; border-top: 1px solid var(--rule); }
.introskill h3 { margin: 0 0 4px; font-size: var(--fs-body); }
.introskill p { margin: 0 0 8px; color: var(--mute); }
.introskill code { font: var(--fs-small) var(--mono); color: var(--mute); word-break: break-word; }

/* Introduction page */
.form { display: flex; justify-content: center; padding: 7vh 32px 48px; }
.formcard { width: 100%; max-width: 640px; }
.back { margin-bottom: 20px; }
.formhead { display: flex; align-items: center; gap: 14px; }
.formhead h1 { margin: 0; font-size: var(--fs-display); font-weight: var(--fw-normal); }
.formcard .go { margin-top: 24px; }   /* Add to message, clear of the last introduction */
.formhead .ic, .formhead .mono { width: 34px; height: 34px; border-radius: 8px; font-size: 13px; }

/* Conversation */
.chat { display: grid; grid-template-rows: auto 1fr auto; overflow: hidden !important; }
.chathead { display: flex; align-items: center; gap: 12px; padding: 12px 24px; border-bottom: 1px solid var(--rule); }
.chathead .ic, .chathead .mono { width: 22px; height: 22px; }
.chattitle { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.chattitle b, .chattitle span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chattitle b { font-weight: var(--fw-bold); }
.chattitle span { font-size: var(--fs-small); color: var(--mute); }
.log { overflow-y: auto; min-height: 0; padding: 24px 32px 40px; display: flex; flex-direction: column; align-items: center; user-select: text; }
.log > * { width: 100%; max-width: var(--col); }
.you { align-self: center; display: flex; flex-direction: column; align-items: flex-end; margin: 18px 0 10px; }
.you .queued { margin-top: 4px; font-size: var(--fs-small); color: var(--mute); }
.you .queued button { margin-left: 8px; padding: 0; border: 0; background: none; font-size: inherit; color: var(--kp); }
.you div { background: var(--side); padding: 10px 16px; border-radius: 16px; max-width: 80%; white-space: pre-wrap; overflow-wrap: anywhere; }
.ned { margin: 8px 0; }
.md { font-size: var(--fs-body); line-height: 22px; overflow-wrap: anywhere; }
.md blockquote { margin-right: 0; }   /* prose, quotes and tables share the column's right edge */
.md > :first-child { margin-top: 0; } .md > :last-child { margin-bottom: 0; }
.md h1, .md h2, .md h3, .md h4 { line-height: 1.3; margin: 18px 0 6px; font-weight: var(--fw-bold); }
.md h1 { font-size: var(--fs-heading); } .md h2 { font-size: var(--fs-heading); } .md h3, .md h4 { font-size: var(--fs-body); }
.md table { border-collapse: collapse; margin: 10px 0; font-size: var(--fs-body); line-height: 1.4; font-variant-numeric: tabular-nums; overflow-wrap: normal; }   /* words whole: a wide table scrolls instead */
.md th, .md td { padding: 4px 18px 4px 0; text-align: left; border-bottom: 1px solid var(--rule); vertical-align: top; }
.md th { color: var(--mute); font-weight: var(--fw-normal); }
.md .num { text-align: right; padding: 4px 0 4px 18px; white-space: nowrap; }   /* a column of figures (chat.js marks it), never broken */
.tablewrap { position: relative; width: fit-content; max-width: 100%; margin: 10px 0; overflow-x: auto; }   /* as wide as its table: Copy table sits at its edge */
.tablewrap table { margin: 0; }
.tablewrap .copytable { display: block; margin: 0 0 2px auto; padding: 2px 8px; border: 0; border-radius: 6px; background: none;
                        font-size: var(--fs-small); color: var(--mute); opacity: 0; }
.tablewrap:hover .copytable, .copytable:focus-visible { opacity: 1; }
.copytable:hover { background: var(--side); color: var(--ink); }
.copytable::after { content: "Copy table"; } .copytable.done::after { content: "Copied"; }
.md code { font: var(--fs-code) var(--mono); background: var(--side); padding: 1px 5px; border-radius: 4px; }
.md pre { background: var(--side); padding: 10px 12px; border-radius: 8px; overflow-x: auto; }
.md pre code { background: none; padding: 0; }
.md a { color: var(--kp); }
.md code.file { color: var(--kp); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.acts { display: flex; gap: 4px; margin-top: 6px; }
.acts button { border: 0; background: none; color: var(--mute); font-size: var(--fs-small); padding: 3px 8px; border-radius: 6px; }
.acts button:hover { background: var(--side); color: var(--ink); }
.tools { margin: 6px 0; font-size: var(--fs-small); color: var(--mute); }
.tools > summary { display: none; width: max-content; padding: 1px 0 1px 22px; cursor: pointer; }   /* shown once the turn has ended (fold, chat.js) */
.tools.folded > summary { display: list-item; list-style-position: inside; padding-left: 4px; }
.tools > summary b { color: var(--red); font-weight: var(--fw-bold); }
.tool { position: relative; display: flex; gap: 10px; padding: 1px 0 1px 22px; white-space: nowrap; overflow: hidden; }
.tool .w { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.tool::before { position: absolute; left: 4px; font-weight: var(--fw-bold); }
.tool.ok::before { content: "\2713"; color: var(--tick); }
.tool.err::before { content: "\2717"; color: var(--red); }
.tool.stop::before { content: "\2013"; color: var(--mute); }   /* a background task stopped (3.16) */
.tool.run::before { content: ""; left: 3px; top: 5px; width: 11px; height: 11px; border-radius: 50%; border: 1.5px solid rgba(0, 94, 157, .22); border-top-color: var(--kp); animation: spin .9s linear infinite; }
.card { margin: 14px 0; padding: 14px 16px; border: 1px solid var(--rule); border-radius: 14px; box-shadow: 0 1px 3px rgba(29, 40, 51, .08); }
.card h3 { margin: 0 0 4px; font-size: var(--fs-body); font-weight: var(--fw-bold); }
.card h3::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--red); margin-right: 8px; vertical-align: middle; }
.card .line { font-size: var(--fs-small); color: var(--mute); margin-bottom: 10px; word-break: break-word; }
.card details { margin-bottom: 12px; }   /* what will be lodged, sent or written: read at body size */
.card summary { color: var(--mute); font-size: var(--fs-small); cursor: pointer; }
.card pre { margin: 6px 0 0; padding: 8px; background: var(--side); border-radius: 8px; font: var(--fs-code) var(--mono); white-space: pre-wrap; max-height: 320px; overflow: auto; }
.card .q { margin: 10px 0; } .card .q > p { margin: 0 0 6px; font-weight: var(--fw-bold); }
.card .choice { display: flex; gap: 10px; align-items: flex-start; padding: 7px 10px; margin: 5px 0; border: 1px solid var(--rule); border-radius: 10px; cursor: pointer; }
.card .choice:has(input:checked) { border-color: var(--kp); box-shadow: inset 0 0 0 1px var(--kp); }
.card .choice input { margin-top: 5px; accent-color: var(--kp); }
.card .choice small { display: block; color: var(--mute); }
.card .own { width: 100%; margin: 4px 0 0; padding: 7px 10px; border: 1px solid var(--rule); border-radius: 10px; }
.card .own:focus { outline: none; border-color: var(--kp); }
.card .buttons { display: flex; gap: 8px; }
.settled { margin: 10px 0; font-size: var(--fs-small); color: var(--mute); }
.finish { margin: 10px 0 2px; font-size: var(--fs-small); color: var(--mute); }
.finish b { color: var(--ink); font-weight: var(--fw-bold); }
.tool .dur { flex: none; }   /* a step's time (timing.js): ticking while it runs */
.workrow { justify-self: center; width: min(100%, calc(var(--col) + 64px)); height: 32px; padding: 8px 32px 0; }   /* kept while hidden: the box does not move */
.working { display: flex; align-items: center; gap: 8px; margin: 0; font-size: var(--fs-small); color: var(--mute); }
.working b { min-width: 50px; color: var(--ink); font-weight: var(--fw-bold); }
.working .state { color: var(--ink); }
.working .need { color: var(--red); font-weight: var(--fw-bold); }
.finish.bad { color: var(--red); }
.caution { margin: -10px 0 0; padding: 0 32px 12px; text-align: center; font-size: var(--fs-small); color: var(--mute); }
.composer { display: flex; justify-content: center; gap: 10px; align-items: flex-end; padding: 12px 32px 18px; }
.composer .field { flex: 1; max-width: 688px; display: flex; flex-direction: column; border: 1px solid var(--rule); border-radius: 16px; }   /* a message box and its screenshots: the reply box and Talk to Ned */
.composer .field:focus-within { border-color: var(--kp); }
.composer .pics { padding: 8px 10px 0; }
.composer textarea { min-height: 48px; max-height: 220px; padding: 11px 14px; border: 0; border-radius: 16px; background: none; }
.composer textarea:focus { outline: none; }

/* Console: the "/" list above a message box */
.composer .field { position: relative; }   /* the list is as wide as its box */
.slash { position: absolute; left: 8px; right: 8px; z-index: 2; max-height: 50vh; overflow-y: auto; background: #fff;
         border: 1px solid var(--rule); border-radius: 10px; box-shadow: 0 6px 20px rgba(29, 40, 51, .12); }
.composer .slash { bottom: calc(100% + 6px); }  /* both boxes are on the floor: the list opens upwards */
.slash button { display: flex; flex-direction: column; width: 100%; padding: 7px 12px; border: 0; background: none; text-align: left; }
.slash button.on, .slash button:hover { background: var(--side); }
.slash b, .slash span { display: block; width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }   /* one line each: the call shape, then the description */
.slash b { font: var(--fs-code) var(--mono); }
.slash span { font-size: var(--fs-small); color: var(--mute); }
/* The rail (rail.js): a third column of panels beside a conversation, each a card that folds; 280px as the desktop app */
body:has(#rail:not([hidden])) { grid-template-columns: 280px 1fr 280px; }
body.pop:has(#rail:not([hidden])) { grid-template-columns: 1fr 280px; }   /* its own window has no list column */
.rail { display: flex; flex-direction: column; gap: 8px; min-height: 0; overflow-y: auto; padding: 12px 12px 16px; border-left: 1px solid var(--rule); background: var(--side); }
.panel { flex: none; background: #fff; border: 1px solid var(--rule); border-radius: 12px; transition: transform .15s; }   /* the others slide aside while one is dragged */
.panel.dragging { box-shadow: 0 6px 20px rgba(29, 40, 51, .16); position: relative; z-index: 2; transition: none; }   /* follows the pointer */
.rail.still .panel { transition: none; }   /* the drop: cards take their new places without sliding back */
.panel .head { display: flex; align-items: center; }
.panel .fold { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 9px 4px 9px 12px; border: 0; border-radius: 12px; background: none; text-align: left; }
.panel .fold::before { content: ""; flex: none; width: 6px; height: 6px; margin: 0 2px; border: solid var(--mute); border-width: 0 1.5px 1.5px 0; transform: rotate(-45deg); transition: transform .15s; }   /* a caret drawn with borders (no glyph for the font to miss), turned down while open */
.panel.open .fold::before { transform: rotate(45deg); }
.panel .title { font-weight: var(--fw-bold); }
.panel .sum { margin-left: auto; font-size: var(--fs-small); color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.panel .sum.warn::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 5px; border-radius: 50%; background: var(--amber); }
.panel .sum.full { color: var(--red); }
.panel .grip { width: 24px; height: 28px; margin-right: 6px; padding: 0; border: 0; border-radius: 6px; background: none; color: var(--mute); cursor: grab; opacity: 0; touch-action: none; }
.panel .grip::before { content: ""; display: block; width: 8px; height: 14px; margin: auto; background: radial-gradient(circle, var(--mute) 1.2px, transparent 1.6px) 0 0 / 4px 4.67px; }   /* six dots: a grip */
.panel:hover .grip, .panel .grip:focus-visible { opacity: 1; }
.panel .grip:hover { background: var(--side); }
.panel .body { padding: 0 12px 12px; }
.rail .note { margin: 4px 0 10px; font-size: var(--fs-small); color: var(--mute); }
.conn { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-top: 1px solid var(--rule); }
.conn .tx { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.conn b { font-weight: var(--fw-normal); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conn span { font-size: var(--fs-small); color: var(--mute); }
.conn span.bad { color: var(--red); }
.conn > .tool { flex: none; width: 14px; height: 20px; padding: 0; }   /* a background task's mark (3.16): a step's, without its line */
.rail .task > summary { list-style: none; cursor: pointer; font-size: inherit; font-weight: inherit; color: inherit; }   /* a row, not a panel's fold (.rail summary) */   /* a background task's row opens on its own steps (3.16) */
.task > summary::-webkit-details-marker { display: none; }
.task[open] > summary { border-bottom: 0; }
.task > .tool, .task > .note { margin-left: 2px; }
.rail details.finished > summary { padding: 7px 0; border-top: 1px solid var(--rule); font-size: var(--fs-small); color: var(--mute); cursor: pointer; }   /* Background tasks' Finished (3.16) */
/* The rail's switch, at the header's right end: a window with its right column filled while the rail shows */
.railbtn { width: 34px; height: 30px; padding: 0; position: relative; }
.railbtn::before { content: ""; position: absolute; inset: 8px 9px; border: 1.5px solid var(--mute); border-radius: 3px; }
.railbtn[aria-pressed="true"]::before { background: linear-gradient(to left, var(--mute) 5px, transparent 5px); }
/* Context (context.js): the bar and the breakdown; Memory files and Connections fold */
.rail .big { margin: 0 0 8px; font-weight: var(--fw-bold); }
.bar { height: 8px; margin-bottom: 10px; border-radius: 4px; background: var(--on); overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--kp); }
.bar.warn span { background: var(--amber); } .bar.full span { background: var(--red); }
.rail details { margin-top: 12px; }
.rail summary { font-size: var(--fs-small); font-weight: var(--fw-bold); color: var(--mute); cursor: pointer; }
.ctxrows { width: 100%; border-collapse: collapse; font-size: var(--fs-small); font-variant-numeric: tabular-nums; }
.ctxrows td { padding: 4px 0; border-top: 1px solid var(--rule); overflow-wrap: anywhere; }
.ctxrows td.num { padding-left: 12px; text-align: right; white-space: nowrap; }
.rail .go { margin-top: 16px; }
/* Outputs (outputs.js): a document a row, its name a link */
.out { padding: 7px 0; border-top: 1px solid var(--rule); }
.out .name { display: block; max-width: 100%; padding: 0; border: 0; background: none; color: var(--kp); text-align: left; overflow-wrap: anywhere;
             text-decoration: underline; text-underline-offset: 2px; }
.out .folder { display: block; font-size: var(--fs-small); color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.out .acts { margin: 2px 0 0 -8px; }

@media (max-width: 720px) { body.pop:has(#rail:not([hidden])) { grid-template-columns: 1fr; } body.pop .rail { display: none; } }   /* a narrow own window: the conversation alone */
@keyframes pulse { 50% { opacity: .35; } }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; } }
@media (max-width: 1000px) { body { grid-template-columns: 220px 1fr; } .lines { grid-template-columns: 1fr 1fr; } body:has(#rail:not([hidden])) { grid-template-columns: 220px 1fr 260px; } .stage { grid-template-columns: 1fr; gap: 4px; } }
