/* Estilos das telas. */

/* Login */
.login { display: grid; place-items: center; min-height: 60dvh; }
.login-card { width: min(420px, 100%); text-align: center; padding: 28px 24px; }
.login-form { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; }
.login-form #code { text-align: center; letter-spacing: 0.3em; }
.sessions-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.login .error-box { margin-top: 12px; text-align: left; }

/* Chat (dentro do cockpit): a conversa rola sozinha, o compositor fica fixo embaixo. */
.chat { display: flex; flex-direction: column; min-height: 0; height: 100%; }
.chat-scroll { flex: 1; min-height: 0; overflow: auto; padding: 0 var(--s-1); scrollbar-gutter: stable; }
.chat-foot { flex: none; padding-top: var(--s-2); }
.chat-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin: 4px 0 10px; }
.chat-model { width: auto; padding: 4px 28px 4px 8px; font-size: var(--fs-sm); font-family: var(--font-mono); }
.chat-meta { color: var(--faint); font-size: var(--fs-xs); }
.drawer { background: var(--glass-strong); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px; margin-bottom: 10px; display: grid; gap: 4px; max-height: 50vh; overflow: auto; }
.drawer-item { text-align: left; background: transparent; border: 1px solid transparent; border-radius: var(--radius-sm); padding: 8px 10px; cursor: pointer; color: var(--text); font-size: var(--fs-sm); }
.drawer-item:hover { border-color: var(--border-strong); background: var(--surface-2); }
.drawer-item.current { border-color: var(--accent); }
.drawer-summary { color: var(--muted); font-size: 12.5px; margin-top: 3px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

.thread { display: flex; flex-direction: column; gap: 12px; padding-bottom: 12px; }
.msg { padding: 10px 14px; border-radius: var(--radius); overflow-wrap: anywhere; max-width: 100%; }
.msg.user { align-self: flex-end; max-width: 85%; background: linear-gradient(160deg, var(--accent-soft), var(--surface-2)); border: 1px solid var(--border-strong); border-bottom-right-radius: 4px; white-space: pre-wrap; }
.msg.user.voice em { font-style: italic; color: var(--text); }
.mic-glyph { font-size: 12px; opacity: 0.8; }
.msg.assistant { align-self: flex-start; background: var(--glass); backdrop-filter: blur(var(--glass-blur)); -webkit-backdrop-filter: blur(var(--glass-blur)); border: 1px solid var(--border); border-bottom-left-radius: 4px; box-shadow: var(--glow-inset), var(--shadow-1); }
.msg.assistant.live { border-color: var(--border-strong); }
.msg.summary { align-self: stretch; max-width: 100%; color: var(--faint); font-size: 12.5px; border: 1px dashed var(--border-strong); background: transparent; white-space: pre-wrap; }
.msg.system { align-self: center; color: var(--muted); font-size: 12.5px; background: transparent; border: 1px solid var(--border); white-space: pre-wrap; text-align: center; }
.msg.error { align-self: stretch; color: var(--danger); border: 1px solid var(--danger); background: var(--danger-soft); }
.msg .usage { color: var(--faint); font: 11px/1.4 var(--font-mono); margin-top: 8px; }
.caret { display: inline-block; width: 7px; height: 14px; margin-left: 2px; vertical-align: -2px; background: var(--accent-2); border-radius: 2px; animation: caret 900ms steps(2, start) infinite; }
@keyframes caret { to { visibility: hidden; } }

.tools { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.tool-chip { display: inline-flex; align-items: center; gap: 6px; font: 500 11px/18px var(--font-mono); padding: 0 8px; border-radius: var(--radius-pill); border: 1px solid var(--border-strong); color: var(--muted); }
.tool-chip::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--accent-2); box-shadow: 0 0 8px var(--accent-2); }
.tool-chip.running { border-color: var(--accent); color: var(--accent-2); animation: chip-pulse 1.2s ease-in-out infinite; }
.tool-chip.ok { color: var(--ok); border-color: rgba(47, 227, 166, 0.4); }
.tool-chip.ok::before { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.tool-chip.error { color: var(--danger); border-color: rgba(255, 77, 109, 0.4); }
.tool-chip.error::before { background: var(--danger); box-shadow: 0 0 8px var(--danger); }
.tool-chip.pending { color: var(--warn); border-color: rgba(255, 180, 84, 0.4); }
.tool-chip.pending::before { background: var(--warn); box-shadow: 0 0 8px var(--warn); }
@keyframes chip-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }

/* Markdown */
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 10px; }
.md h2, .md h3, .md h4 { font-family: var(--font-display); color: var(--text); letter-spacing: var(--ls-tight); margin: 12px 0 6px; line-height: 1.2; }
.md h2 { font-size: var(--fs-h2); } .md h3 { font-size: 17px; } .md h4 { font-size: var(--fs-h3); }
.md ul, .md ol { margin: 0 0 10px; padding-left: 22px; }
.md li { margin: 3px 0; }
.md blockquote { margin: 0 0 10px; padding: 4px 12px; border-left: 2px solid var(--accent); color: var(--muted); }
.md code { font-family: var(--font-mono); font-size: 12.5px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; }
.md pre.md-code { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; overflow-x: auto; margin: 0 0 10px; }
.md pre.md-code code { border: 0; background: transparent; padding: 0; }
.md hr { border: 0; border-top: 1px solid var(--border); margin: 12px 0; }
.md a { color: var(--accent-2); }

/* Ações (confirmação) */
.action { align-self: flex-start; max-width: 100%; width: 100%; padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--border-strong); background: var(--glass); }
.action.status-pending { border-color: var(--warn); box-shadow: 0 0 24px var(--warn-soft); }
.action .head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: var(--fs-sm); margin-bottom: 8px; }
.action .glyph { font-size: 20px; line-height: 1; color: var(--accent-2); }
.action-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.action.status-pending .action-dot { background: var(--warn); box-shadow: 0 0 10px var(--warn); }
.action.status-approved .action-dot { background: var(--info); box-shadow: 0 0 10px var(--info); }
.action.status-executed .action-dot { background: var(--ok); box-shadow: 0 0 10px var(--ok); }
.action.status-failed .action-dot { background: var(--danger); box-shadow: 0 0 10px var(--danger); }
.action .buttons { display: flex; gap: 8px; margin-top: 10px; }
.action .result { color: var(--muted); font-size: 12px; margin-top: 8px; white-space: pre-wrap; }

/* Compositor */
.composer {
  display: flex; gap: 8px; align-items: flex-end;
  padding: 6px 0 4px;
}
.composer textarea { flex: 1; resize: none; min-height: 44px; max-height: 40vh; line-height: 1.4; }
.composer .btn-icon { width: 44px; height: 44px; flex: none; }
.composer .btn-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.composer .mic.active { border-color: var(--accent-3); color: var(--accent-3); box-shadow: var(--glow-hot); animation: chip-pulse 1.2s ease-in-out infinite; }
.chat-hints { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; font-size: var(--fs-xs); color: var(--muted); padding: 2px 2px 0; }
.toggle { display: inline-flex; gap: 5px; align-items: center; cursor: pointer; }
.toggle input { accent-color: var(--accent); margin: 0; }
.hint-keys { margin-left: auto; }
@media (max-width: 719px) { .hint-keys { display: none; } }

/* Seções (Lembretes, Uso) */
.section { margin-bottom: 26px; }
.section-title { display: flex; align-items: center; gap: 10px; font: 600 var(--fs-xs)/1 var(--font-mono); letter-spacing: var(--ls-label); text-transform: uppercase; color: var(--muted); margin: 0 0 10px; }
.section-title::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--border-strong), transparent); }

/* Memória */
.change .head, .hit .head { gap: 8px; }
.change .path, .hit a { color: var(--text); }
.change .path:hover, .hit a:hover { color: var(--accent-2); }
.diff { margin-top: 10px; background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; max-height: 50vh; overflow: auto; }
.diff .add { color: var(--ok); }
.diff .del { color: var(--danger); }
.diff .hunk { color: var(--info); }
.snippet { color: var(--muted); font-size: var(--fs-sm); margin-top: 6px; white-space: pre-wrap; }
.page-panel { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border-strong); }
.page-body { max-height: 70vh; overflow: auto; }
.page-editor { display: block; width: 100%; min-height: 55vh; resize: vertical; font-size: var(--fs-sm); line-height: 1.5; tab-size: 2; white-space: pre-wrap; }
.page-panel .error-box { margin-top: 8px; }
table.table tr.cold td { color: var(--faint); }

/* Uso */
.totals { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.stat { background: var(--glass); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 14px; min-width: 110px; box-shadow: var(--glow-inset); }
.stat-v { font: 600 22px/1.1 var(--font-display); letter-spacing: var(--ls-tight); color: var(--accent-2); }
.stat-k { font-size: 10.5px; color: var(--muted); font-family: var(--font-mono); letter-spacing: var(--ls-label); text-transform: uppercase; }
.chart { width: 100%; height: auto; margin-bottom: 12px; }
.chart .axis { fill: var(--faint); font: 11px var(--font-mono); }
.chart .bar-in { fill: var(--accent); opacity: 0.65; }
.chart .bar-out { fill: var(--accent-3); }
.chart .axis-line { stroke: var(--border-strong); }
td.args { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Login: o orbe apresenta a casa. */
.login-orb { --orb-size: 150px; margin: 4px auto 14px; display: flex; justify-content: center; }
