/*
   Stránka Agent — vlastní vzhled, odlišný od zbytku konzole: papír, inkoust a zvýrazňovač.
   Na celou výšku okna, tři sloupce: konverzace, chat, výstup agenta (jen když nějaký je).
   Žlutá patří jen označenému (řádky, citace), modrá jen odkazům a běžícímu kroku.
*/

@font-face {
    font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400 600; font-display: swap;
    src: url(../fonts/plex-sans-latin-ext.woff2) format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400 600; font-display: swap;
    src: url(../fonts/plex-sans-latin.woff2) format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400; font-display: swap;
    src: url(../fonts/plex-mono-400-latin-ext.woff2) format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400; font-display: swap;
    src: url(../fonts/plex-mono-400-latin.woff2) format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: "IBM Plex Mono"; font-style: normal; font-weight: 500; font-display: swap;
    src: url(../fonts/plex-mono-500-latin-ext.woff2) format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: "IBM Plex Mono"; font-style: normal; font-weight: 500; font-display: swap;
    src: url(../fonts/plex-mono-500-latin.woff2) format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Proměnné jsou na <body>, ne na .agent: bere si je i horní lišta a tlačítko citace, které žije v <body>. */
body:has(.agent) {
    --paper: #f4f1ea;
    --sheet: #fffdf8;
    --ink: #17191c;
    --ink-2: #474b52;
    --dim: #7d7a72;
    --rule: #e4dfd2;
    --rule-strong: #cdc6b4;
    --blue: #1f3fbf;
    --blue-soft: #e8ecfb;
    --mark: #ffe45c;
    --mark-soft: #fff7c9;
    --mark-edge: #e3bd00;
    --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
    --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    background: var(--paper);
    font-family: var(--sans);
}
body:has(.agent) #app { height: 100dvh; display: flex; flex-direction: column; }
body:has(.agent) main { flex: 1; min-height: 0; max-width: none; margin: 0; padding: 0; width: 100%; }
body:has(.agent) header.topbar { background: var(--paper); border-bottom-color: var(--rule); padding: 0.55rem 1.25rem; }
body:has(.agent) header.topbar nav a.active { background: var(--ink); color: var(--sheet); }

.agent {
    --rail: 264px;
    --out: 0px;
    height: 100%;
    display: grid;
    grid-template-columns: var(--rail) minmax(0, 1fr) var(--out);
    color: var(--ink);
    background: var(--sheet);
}
/* Tabulka rozpočtu má sedm sloupců, výstup proto bere skoro polovinu šířky. Šířku si uživatel
   mění dělicí čárou (--out-w, chat.js); výstup má vždy aspoň 340 px a chatu zbyde aspoň 360 px. */
.agent.has-output { --out: clamp(340px, var(--out-w, 46%), calc(100% - var(--rail) - 360px)); }
.agent.no-rail { --rail: 0px; }
.agent.no-rail .rail { display: none; }
.agent-main { grid-column: 2; }
.agent-panel { grid-column: 3; }

.agent button { background: none; color: inherit; padding: 0; border-radius: 8px; font: inherit; }
.agent svg {
    width: 16px; height: 16px; flex: none;
    fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
}
.agent .spacer { flex: 1; }
.agent :focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
.agent ::selection { background: var(--mark); color: var(--ink); }

.agent .icon { display: grid; place-items: center; width: 30px; height: 30px; color: var(--ink-2); }
.agent .icon:hover:not(:disabled) { background: var(--paper); color: var(--ink); }
.agent .icon:disabled { opacity: .3; }
.agent .ghost {
    padding: 4px 9px; border-radius: 7px; font-size: 12.5px; font-weight: 500; color: var(--ink-2);
    white-space: nowrap;
}
.agent .ghost:hover { background: var(--paper); color: var(--ink); }
.agent .link { color: var(--blue); font-weight: 600; margin-left: 6px; padding: 0 2px; }
.agent .link:hover { text-decoration: underline; }
.agent .link.danger { color: var(--danger); }

/* --- Konverzace --- */

.rail {
    grid-column: 1; min-width: 0;
    border-right: 1px solid var(--rule); background: var(--paper);
    padding: 14px 10px; overflow-y: auto;
}
.agent .new-chat {
    display: flex; align-items: center; gap: 8px; width: 100%; padding: 9px 12px;
    background: var(--ink); color: var(--sheet); font-weight: 600; font-size: 13px; border-radius: 9px;
}
.agent .new-chat:hover:not(:disabled) { background: #000; }
.rail-search, .agent .rename {
    width: 100%; font: inherit; font-size: 13px; color: var(--ink);
    padding: 7px 10px; border: 1px solid var(--rule); border-radius: 8px; background: var(--sheet);
}
.rail-search { margin-top: 10px; }
.list-label {
    margin: 18px 8px 4px; font-family: var(--mono); font-size: 10.5px; font-weight: 500;
    letter-spacing: .08em; text-transform: uppercase; color: var(--dim);
}
.list-empty { margin: 16px 8px; color: var(--dim); font-size: 13px; line-height: 1.5; }
.rail ul { list-style: none; margin: 0; padding: 0; }
.rail li { position: relative; display: flex; align-items: center; min-height: 34px; border-radius: 8px; }
.rail li:hover { background: #ebe7dc; }
.rail li.active { background: var(--sheet); box-shadow: inset 0 0 0 1px var(--rule-strong); }
.rail .open {
    flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 8px;
    text-align: left; padding: 8px 10px;
}
.rail .t { flex: 1; min-width: 0; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail li.active .t { font-weight: 600; }
.rail .when { font-family: var(--mono); font-size: 11px; color: var(--dim); }
.rail .row-actions {
    position: absolute; right: 4px; display: none; gap: 2px; padding-left: 14px;
    background: linear-gradient(to right, transparent, #ebe7dc 14px);
}
.rail li.active .row-actions { background: linear-gradient(to right, transparent, var(--sheet) 14px); }
.rail li:hover .row-actions, .rail li:focus-within .row-actions { display: flex; }
.rail .row-actions button { padding: 5px; color: var(--dim); }
.rail .row-actions button:hover { color: var(--ink); }
.rail .row-actions .del:hover { color: var(--danger); }
.rail .confirm { flex: 1; padding-left: 10px; font-size: 13px; }
.rail li .link { font-size: 12.5px; margin: 0 6px 0 0; }
.rail .rename { margin: 2px; padding: 5px 8px; }

/* --- Chat --- */

.agent-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.chat-head {
    display: flex; align-items: center; gap: 8px; height: 46px; padding: 0 14px; flex: none;
    border-bottom: 1px solid var(--rule);
}
.chat-title { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agent .outputs {
    display: flex; align-items: center; gap: 7px; padding: 5px 10px;
    border: 1px solid var(--rule-strong); font-size: 12.5px; font-weight: 600;
}
.agent .outputs:hover { background: var(--paper); }
.outputs .n { font-family: var(--mono); font-weight: 500; color: var(--dim); }

.agent-log { flex: 1; overflow-y: auto; padding: 28px 28px 12px; }
.agent-log > * { max-width: 740px; margin-left: auto; margin-right: auto; }

.welcome { padding-top: 7vh; }
.welcome .kicker {
    margin: 0 0 14px; font-family: var(--mono); font-size: 11px; letter-spacing: .08em;
    text-transform: uppercase; color: var(--dim);
}
.welcome h1 { font-size: 36px; font-weight: 600; letter-spacing: -.025em; line-height: 1.1; margin: 0 0 14px; }
.welcome .lead { color: var(--ink-2); font-size: 15.5px; line-height: 1.6; max-width: 580px; margin: 0 0 34px; }
.starters { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule-strong); }
.starters li { border-bottom: 1px solid var(--rule); }
.agent .starters button {
    display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; align-items: baseline; gap: 12px;
    width: 100%; padding: 13px 8px 13px 2px; text-align: left; border-radius: 0;
}
.starters .kind { font-family: var(--mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--dim); }
.starters .prompt { font-size: 14.5px; line-height: 1.45; }
.starters svg { align-self: center; color: var(--rule-strong); transition: transform .15s, color .15s; }
.agent .starters button:hover { background: var(--paper); }
.starters button:hover svg { color: var(--ink); transform: translateX(3px); }
.welcome .tip { margin: 18px 0 0; font-size: 13px; color: var(--dim); }
.welcome .tip::before {
    content: ""; display: inline-block; width: 22px; height: 9px; margin-right: 8px;
    background: var(--mark); border-radius: 2px; vertical-align: baseline;
}

.turn { margin-bottom: 34px; }
.question {
    margin-left: auto; width: fit-content; max-width: 80%;
    background: #ece8dc; padding: 10px 14px; border-radius: 14px 14px 3px 14px;
    font-size: 15px; line-height: 1.5; margin-bottom: 20px;
}
.q-text { white-space: pre-wrap; }

/* Označené u otázky a v poli zprávy: položka s kódem, nebo citace textu. */
.refs { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.refs li { display: flex; align-items: baseline; gap: 8px; min-width: 0; font-size: 12.5px; line-height: 1.4; color: var(--ink-2); }
.refs .code {
    flex: none; font-family: var(--mono); font-size: 12px; font-weight: 500; color: var(--ink);
    background: var(--mark); padding: 0 5px; border-radius: 3px;
}
.refs .text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.refs .quote .text {
    white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
    padding-left: 8px; border-left: 3px solid var(--mark-edge); color: var(--ink);
}

.agent .who {
    display: flex; align-items: center; gap: 8px; margin-bottom: 8px;
    font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: .08em;
    text-transform: uppercase; color: var(--dim);
}
.agent .who::before { content: ""; width: 7px; height: 7px; background: var(--ink); }
.agent .who .elapsed { letter-spacing: 0; text-transform: none; color: var(--blue); font-variant-numeric: tabular-nums; }

.thinking { padding: 6px 0; font-size: 14px; color: var(--dim); }
.thinking span {
    display: inline-block; width: 7px; height: 15px; margin-left: 5px; vertical-align: -2px;
    background: var(--ink); animation: caret 1s steps(2, start) infinite;
}
@keyframes caret { to { visibility: hidden; } }

/* Postup odpovědi */
.steps { margin: 2px 0 12px; }
.agent .steps-toggle {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 12.5px; color: var(--dim); padding: 3px 6px 3px 0;
}
.agent .steps-toggle:hover { color: var(--ink); }
.steps-toggle .chev { width: 14px; height: 14px; transition: transform .15s; }
.steps-toggle .chev.open { transform: rotate(90deg); }
.steps ol { list-style: none; margin: 6px 0 0; padding: 0 0 0 4px; }
.steps .step {
    position: relative; display: flex; align-items: baseline; gap: 8px;
    padding: 3px 0 3px 18px; font-size: 13px; color: var(--ink-2);
}
.steps .step::before {
    content: ""; position: absolute; left: 3px; top: 15px; bottom: -6px; width: 1px; background: var(--rule-strong);
}
.steps .step:last-child::before { display: none; }
.steps .dot { position: absolute; left: 0; top: 8px; width: 7px; height: 7px; background: var(--ink); }
.steps .running .dot { background: var(--blue); animation: pulse 1.4s infinite; }
.steps .running .label { color: var(--ink); font-weight: 500; }
.steps .failed .dot { background: #c77700; }
.steps .stopped .dot { background: var(--rule-strong); }
.steps .time, .steps .note { font-family: var(--mono); font-size: 11.5px; color: var(--dim); }
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(31, 63, 191, .45); }
    70% { box-shadow: 0 0 0 6px rgba(31, 63, 191, 0); }
    100% { box-shadow: 0 0 0 0 rgba(31, 63, 191, 0); }
}

/* Text odpovědi */
.agent .md { font-size: 15.5px; line-height: 1.65; color: var(--ink); }
.agent .md + .md { margin-top: 6px; }
.agent .md.interim {
    font-size: 13.5px; line-height: 1.55; color: var(--dim);
    border-left: 2px solid var(--rule); padding-left: 10px; margin-bottom: 12px;
}
.agent .md p { margin: 0 0 .75em; }
.agent .md p:last-child { margin-bottom: 0; }
.agent .md ul, .agent .md ol { margin: .3em 0 .8em; padding-left: 1.3em; }
.agent .md li { margin: .2em 0; }
.agent .md strong { font-weight: 600; }
.agent .md a { color: var(--blue); }
.agent .md code { font-family: var(--mono); font-size: .86em; background: var(--paper); padding: 1px 5px; border-radius: 4px; }
.agent .md table { margin: .6em 0; font-size: 13.5px; }
.agent .md th, .agent .md td { border-bottom-color: var(--rule); }

.answer-actions { margin: 10px 0 0 -9px; }
.state { margin-top: 10px; font-size: 13px; color: var(--dim); }
.state.error { color: var(--danger); }

/* --- Artefakt: list papíru s tabulkou --- */

.artifact {
    margin: 16px 0 4px; display: flex; flex-direction: column; min-height: 0;
    border: 1px solid var(--rule-strong); border-radius: 10px; overflow: hidden; background: var(--sheet);
}
.artifact figcaption { display: flex; align-items: center; gap: 10px; padding: 12px 14px 4px; }
.artifact .title { font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.artifact .count { font-family: var(--mono); font-size: 11.5px; color: var(--dim); }
.artifact .filter {
    width: 190px; font: inherit; font-size: 12.5px; color: var(--ink);
    padding: 5px 9px; border: 1px solid var(--rule); border-radius: 7px; background: var(--sheet);
}
.artifact-actions {
    display: flex; align-items: center; flex-wrap: wrap; gap: 2px; padding: 2px 6px 8px;
    border-bottom: 1px solid var(--rule-strong);
}
.artifact-actions .scope {
    padding: 0 8px; font-family: var(--mono); font-size: 10.5px; letter-spacing: .06em;
    text-transform: uppercase; color: var(--dim);
}
.artifact .table-wrap { max-height: 440px; overflow: auto; }
.artifact table { font-size: 13.5px; }
.artifact th {
    position: sticky; top: 0; z-index: 1; background: var(--sheet);
    font-family: var(--mono); font-size: 10.5px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase;
    color: var(--dim); padding: 8px 10px; border-bottom: 1px solid var(--rule-strong); white-space: nowrap;
}
.artifact td { padding: 8px 10px; border-bottom: 1px solid var(--rule); vertical-align: top; line-height: 1.45; }
.artifact tbody:last-child tr:last-child td { border-bottom: 0; }
.artifact tbody tr:not(.layer) { cursor: pointer; }
.artifact tbody tr:not(.layer):hover td { background: #faf7ee; }
.artifact .pick { width: 30px; padding-right: 0; }
.artifact .pick input { margin: 2px 0 0; width: 14px; height: 14px; accent-color: var(--ink); cursor: pointer; }
.artifact .code { font-family: var(--mono); font-size: 12.5px; white-space: nowrap; }
.artifact .unit { text-align: center; white-space: nowrap; color: var(--ink-2); }
.artifact .num { text-align: right; white-space: nowrap; font-family: var(--mono); font-size: 12.5px; }
.artifact td.num { font-weight: 500; }

/* Označený řádek: přejetý zvýrazňovačem. */
.artifact tbody tr.marked td, .artifact tbody tr.marked:hover td { background: var(--mark-soft); }
.artifact tr.marked td:first-child { box-shadow: inset 3px 0 0 var(--mark-edge); }

/* Rozpočet konstrukce: vrstvy jako mezititulky, materiál odsazený pod montáží. */
.artifact.composition .layer td {
    padding: 7px 10px; background: var(--paper); border-bottom: 1px solid var(--rule-strong);
    font-size: 12px; font-weight: 600; letter-spacing: .01em;
}
.artifact.composition .mat .desc { padding-left: 26px; color: var(--ink-2); }
.artifact.composition .missing td { color: var(--dim); }
.artifact .tag {
    display: inline-block; margin-left: 6px; padding: 0 7px; border-radius: 4px;
    font-family: var(--sans); font-size: 11px; font-weight: 600; line-height: 18px; white-space: nowrap;
    color: var(--blue); background: var(--blue-soft);
}
.artifact .tag.warn { color: #8a5200; background: #fbeed3; }
.artifact-unknown { font-size: 13px; color: var(--dim); }

.marked-bar {
    display: flex; align-items: center; flex-wrap: wrap; gap: 2px 8px; min-height: 40px; padding: 5px 8px 5px 14px;
    border-top: 1px solid var(--rule-strong); font-size: 12.5px; color: var(--dim);
}
.marked-bar.on { background: var(--mark-soft); border-top-color: var(--mark-edge); color: var(--ink-2); }
.marked-bar .n { font-weight: 600; color: var(--ink); }
.agent .marked-bar .ghost:hover { background: var(--mark); }

/* Odkaz na artefakt v chatu; samotný artefakt je v panelu vpravo. */
.agent .artifact-chip {
    display: flex; align-items: center; gap: 9px; margin: 14px 0 4px; max-width: 100%;
    padding: 9px 10px 9px 12px; border: 1px solid var(--rule-strong); border-radius: 9px;
    font-size: 13px; text-align: left; background: var(--sheet);
}
.agent .artifact-chip:hover { background: var(--paper); }
.agent .artifact-chip.current { box-shadow: inset 3px 0 0 var(--ink); }
.artifact-chip .title { font-weight: 600; }
.artifact-chip .summary { font-family: var(--mono); font-size: 11.5px; color: var(--dim); }
.artifact-chip .marked-n { font-size: 11.5px; font-weight: 600; background: var(--mark); padding: 0 6px; border-radius: 3px; }
.artifact-chip .go { color: var(--dim); }
.artifact-inline { display: none; }

/* Tlačítko nad označeným textem; žije v <body> (chat.js). */
.quote-pop {
    position: fixed; z-index: 20; display: flex; align-items: center; gap: 7px;
    padding: 6px 11px; border: 0; border-radius: 8px; cursor: pointer;
    font: 600 12.5px/1.3 var(--sans, system-ui); color: #fffdf8; background: #17191c;
    box-shadow: 0 6px 20px rgba(23, 25, 28, .28);
}
.quote-pop[hidden] { display: none; }
.quote-pop::before { content: ""; width: 14px; height: 8px; border-radius: 2px; background: #ffe45c; }

/* --- Dotaz agenta (ask_user) --- */

.ask {
    margin: 14px 0 4px; border: 1px solid var(--ink); border-radius: 10px; background: var(--sheet);
    padding: 14px 14px 12px; outline: none;
}
.ask-tabs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 10px; }
.ask-kicker {
    font-family: var(--mono); font-size: 10.5px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase;
    color: var(--ink); margin-right: 4px;
}
.agent .ask-tab {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 12px; font-weight: 600; color: var(--dim);
    padding: 3px 9px; border-radius: 6px; background: var(--paper);
}
.agent .ask-tab.current { color: var(--sheet); background: var(--ink); }
.agent .ask-tab.done:not(.current) { color: var(--ink); }
.agent .ask-tab svg { width: 12px; height: 12px; stroke-width: 2.2; }
.ask-question { margin: 0 0 12px; font-size: 15.5px; font-weight: 600; line-height: 1.45; }
.ask-options { display: flex; flex-direction: column; gap: 6px; }
.agent .ask-option {
    display: flex; align-items: flex-start; gap: 12px; width: 100%; text-align: left; cursor: pointer;
    padding: 10px 12px; border: 1px solid var(--rule); border-radius: 8px; background: var(--sheet);
}
.agent .ask-option:hover { border-color: var(--rule-strong); background: var(--paper); }
.agent .ask-option.selected { border-color: var(--ink); background: var(--mark-soft); }
.ask-option .num {
    flex: none; width: 22px; height: 22px; border-radius: 5px; display: grid; place-items: center; margin-top: 1px;
    font-family: var(--mono); font-size: 12px; font-weight: 500; color: var(--ink-2); background: var(--paper);
}
.ask-option.selected .num { background: var(--ink); color: var(--sheet); }
.ask-option .body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ask-option .label { font-size: 14px; font-weight: 600; }
.ask-option .desc { font-size: 13px; color: var(--dim); line-height: 1.45; }
.ask-option .mark {
    flex: none; width: 16px; height: 16px; margin-top: 4px; border-radius: 50%;
    border: 1.5px solid var(--rule-strong); background: var(--sheet);
}
.ask-option[role="checkbox"] .mark { border-radius: 4px; }
.ask-option.selected .mark { border-color: var(--ink); background: var(--ink); box-shadow: inset 0 0 0 3px var(--sheet); }
.ask-option.other input { font-size: 14px; padding: 6px 8px; margin: -2px 0; }
.ask-foot { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.ask-foot .hint { font-size: 12px; color: var(--dim); }
.agent .ask-send, .agent .ask-next {
    padding: 7px 14px; border-radius: 8px; font-size: 13px; font-weight: 600;
    background: var(--ink); color: var(--sheet);
}
.agent .ask-next { background: var(--paper); color: var(--ink); }
.agent .ask-send:disabled, .agent .ask-next:disabled { opacity: .4; cursor: not-allowed; }
.ask-answered {
    display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin: 6px 0 12px;
    padding: 8px 12px; border-radius: 8px; background: var(--paper); font-size: 13px;
}
.ask-answered dt { color: var(--dim); font-weight: 600; }
.ask-answered dd { margin: 0; }

/* --- Pole zprávy --- */

.composer {
    width: calc(100% - 56px); max-width: 740px; margin: 0 auto; flex: none;
    border: 1px solid var(--rule-strong); border-radius: 14px; background: #fff;
    box-shadow: 0 1px 0 var(--rule), 0 8px 24px rgba(60, 50, 20, .07);
}
.composer:focus-within { border-color: var(--ink); }
.composer .refs {
    max-height: 132px; overflow-y: auto; margin: 0; padding: 10px 12px 8px 14px;
    border-bottom: 1px dashed var(--rule-strong);
}
.composer .refs li { align-items: center; flex: none; }
.agent .composer .refs button { margin-left: auto; padding: 2px; color: var(--dim); flex: none; }
.agent .composer .refs button:hover { color: var(--ink); background: var(--paper); }
.composer .refs svg { width: 13px; height: 13px; }
.composer-row { display: flex; align-items: flex-end; gap: 8px; padding: 8px 8px 8px 16px; }
.composer textarea {
    flex: 1; border: 0; outline: 0; resize: none; background: transparent;
    font: inherit; font-size: 15px; line-height: 1.5; padding: 6px 0; max-height: 200px; color: var(--ink);
}
.composer textarea::placeholder { color: #a39f95; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Zaměření ukazuje rámeček celého pole (.composer:focus-within). */
.agent .composer textarea:focus-visible { outline: none; }
.agent .composer .send, .agent .composer .stop {
    width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center;
    background: var(--ink); color: var(--sheet);
}
.agent .composer .send:disabled { background: #d9d4c7; opacity: 1; }
.composer .stop rect { fill: currentColor; stroke: none; }
.composer-notice { margin: 0 4px 8px; font-size: 13px; color: var(--danger); }
.composer-hint { text-align: center; font-size: 11.5px; color: var(--dim); padding: 7px 0 12px; }

/* --- Panel výstupu --- */

.agent-panel {
    display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden;
    border-left: 1px solid var(--rule); background: var(--paper); padding: 0 16px 16px;
}
.agent-panel { position: relative; }
.splitter {
    position: absolute; left: -5px; top: 0; bottom: 0; width: 10px; z-index: 5;
    cursor: col-resize; touch-action: none;
}
.splitter::after {
    content: ""; position: absolute; left: 4px; top: 0; bottom: 0; width: 2px;
    background: transparent; transition: background .12s;
}
.splitter:hover::after, .splitter:active::after, .splitter:focus-visible::after { background: var(--ink); }
.agent .splitter:focus-visible { outline: none; }
.panel-head { display: flex; align-items: center; gap: 4px; height: 46px; flex: none; }
.panel-head .label {
    margin-right: 8px; font-family: var(--mono); font-size: 11px; font-weight: 500;
    letter-spacing: .08em; text-transform: uppercase; color: var(--dim);
}
.panel-head .pos { font-family: var(--mono); font-size: 12px; color: var(--ink-2); }
/* Roluje tabulka, ne panel, aby hlavička i lišta označených zůstaly na místě. */
.agent-panel .artifact { margin: 0; flex: 0 1 auto; box-shadow: 0 10px 30px rgba(60, 50, 20, .08); }
.agent-panel .artifact .table-wrap { max-height: none; min-height: 0; flex: 0 1 auto; }
/* V úzkém výstupu se tabulka neláme do nečitelných sloupců, ale posouvá do strany. */
.artifact.composition table { min-width: 640px; }
.artifact.item_list table { min-width: 420px; }
.artifact figcaption, .artifact-actions { flex-wrap: wrap; }
.artifact .filter { flex: 1 1 140px; max-width: 220px; min-width: 0; }
/* Úzký chat: menší okraje, ať textu zbyde místo. */
.agent-main { container-type: inline-size; }
@container (max-width: 520px) {
    .agent-log { padding-left: 16px; padding-right: 16px; }
    .composer { width: calc(100% - 28px); }
    .question { max-width: 92%; }
    .composer-hint { display: none; }
    .composer { margin-bottom: 12px; }
}

@media (max-width: 1180px) {
    .agent { --rail: 228px; }
    .agent.no-rail { --rail: 0px; }
}
@media (max-width: 900px) {
    .agent, .agent.has-output { --rail: 0px; --out: 0px; }
    .rail, .agent-panel, .agent .artifact-chip, .chat-head .icon, .agent .outputs { display: none; }
    .artifact-inline { display: block; }
    .welcome h1 { font-size: 28px; }
    .agent .starters button { grid-template-columns: minmax(0, 1fr) auto; }
    .starters .kind { display: none; }
}

/* --- Hodnocení odpovědi (docs/plans/answer-feedback, dočasná funkce) --- */

.feedback-box { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--rule); font-size: 12.5px; color: var(--ink-2); }
.feedback-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.feedback-question { color: var(--dim); margin-right: 4px; }
.agent .feedback-head button {
    padding: 3px 10px; border: 1px solid var(--rule-strong); border-radius: 7px; background: var(--sheet); font-size: 12.5px;
}
.agent .feedback-head button:hover:not(:disabled) { background: var(--paper); }
.agent .feedback-head button.on { border-color: var(--ink); background: var(--ink); color: var(--sheet); }
.feedback-box textarea {
    display: block; width: 100%; margin-top: 8px; padding: 8px 10px; box-sizing: border-box;
    border: 1px solid var(--rule-strong); border-radius: 8px; font: inherit; font-size: 13.5px; resize: vertical; background: #fff;
}
.feedback-actions { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.agent .feedback-actions .send {
    padding: 5px 12px; border-radius: 7px; font-weight: 600; background: var(--ink); color: var(--sheet);
}
.agent .feedback-actions .send:disabled { opacity: .4; cursor: not-allowed; }
.feedback-note { margin: 6px 0 0; font-size: 12px; color: var(--dim); }
.feedback-note + .feedback-note { margin-top: 1px; }
.feedback-error { margin-top: 6px; color: var(--danger); }
.feedback-entries { list-style: none; margin: 8px 0 0; padding: 0; font-size: 12px; }
.feedback-entries li { display: flex; align-items: baseline; gap: 8px; padding: 3px 0; border-top: 1px solid var(--rule); }
.feedback-entries .when { font-family: var(--mono); color: var(--dim); white-space: nowrap; }
.feedback-entries .verdict { font-weight: 600; white-space: nowrap; }
.feedback-entries .verdict.remark { color: var(--danger); }
.feedback-entries .text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
