/* ========== Transcolar AI — Tema verde/laranja moderno ========== */
:root {
  --tc-green-50:  #ecfdf5;
  --tc-green-100: #d1fae5;
  --tc-green-500: #10b981;
  --tc-green-600: #059669;
  --tc-green-700: #047857;
  --tc-green-900: #064e3b;
  --tc-orange-400:#fb923c;
  --tc-orange-500:#f97316;
  --tc-orange-600:#ea580c;
  --tc-bg: #f6f8f7;
  --tc-surface: #ffffff;
  --tc-border: #e7eae8;
  --tc-text: #0f1f1a;
  --tc-text-muted: #5b6b65;
  --tc-shadow: 0 12px 32px rgba(6, 78, 59, 0.10);
  --tc-radius: 14px;
  --bs-primary: var(--tc-green-600);
  --bs-primary-rgb: 5,150,105;
}

html, body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--tc-bg);
  color: var(--tc-text);
  -webkit-font-smoothing: antialiased;
  height: 100%;
}
body { margin: 0; }

.btn-primary {
  background: linear-gradient(135deg, var(--tc-green-600), var(--tc-green-500));
  border: none;
  color: #fff;
  font-weight: 600;
  letter-spacing: .2px;
  box-shadow: 0 6px 18px rgba(5,150,105,.25);
}
.btn-primary:hover, .btn-primary:focus {
  background: linear-gradient(135deg, var(--tc-green-700), var(--tc-green-600));
  color: #fff;
}
.form-control:focus, .form-select:focus {
  border-color: var(--tc-green-500);
  box-shadow: 0 0 0 .2rem rgba(16,185,129,.18);
}

/* ===== Login ===== */
.login-body {
  min-height: 100vh;
  background:
    radial-gradient(1100px 600px at 90% -10%, rgba(249,115,22,.18), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(16,185,129,.22), transparent 60%),
    linear-gradient(180deg, #fafaf7, #eef6f1);
  display: grid;
  place-items: center;
  padding: 24px 16px;
}
.login-shell {
  width: 100%;
  max-width: 460px;
}
.login-card {
  background: var(--tc-surface);
  border-radius: 22px;
  padding: 32px 28px;
  border: 1px solid var(--tc-border);
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark {
  width: 54px; height: 54px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--tc-green-600), var(--tc-green-500));
  display: grid; place-items: center;
  position: relative;
  box-shadow: 0 10px 24px rgba(5,150,105,.35);
}
.brand-mark .dot { width: 14px; height: 14px; border-radius: 50%; display: inline-block; }
.brand-mark .dot-green { background: #fff; opacity: .95; }
.brand-mark .dot-orange { background: var(--tc-orange-500); margin-left: -6px; box-shadow: 0 0 0 3px rgba(255,255,255,.3); }
.brand-name { font-weight: 800; margin: 0; font-size: 1.55rem; letter-spacing: -.02em; color: var(--tc-green-900); }
.brand-ai { color: var(--tc-orange-500); }
.brand-sub { color: var(--tc-text-muted); margin: 0; font-size: .92rem; }
.login-foot { color: var(--tc-text-muted); font-size: .85rem; text-align: center; margin: 18px 0 0; }
.login-credit { text-align: center; color: var(--tc-text-muted); font-size: .8rem; margin-top: 16px; }

/* ===== App shell ===== */
.app-body { background: var(--tc-bg); height: 100vh; overflow: hidden; }
.app-shell { display: grid; grid-template-columns: 280px 1fr; height: 100vh; }
@media (max-width: 991px) {
  .app-shell { grid-template-columns: 1fr; }
}

/* Sidebar */
.sidebar {
  background: linear-gradient(180deg, #0c2620 0%, #0a1f1a 100%);
  color: #d3e7df;
  display: flex; flex-direction: column;
  border-right: 1px solid #163a31;
  height: 100vh;
  overflow: hidden;
}
@media (max-width: 991px) {
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: 86vw; max-width: 320px;
    z-index: 1040;
    transform: translateX(-100%);
    transition: transform .25s ease;
  }
  .sidebar.open { transform: translateX(0); }
}
.sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 16px 8px;
}
.brand-mini { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.brand-mini-name { font-size: 1rem; color: #fff; letter-spacing: -.01em; }
.brand-mini-name b { color: var(--tc-orange-400); }
.brand-mini .dot { width: 10px; height: 10px; border-radius: 50%; }
.brand-mini .dot-green { background: var(--tc-green-500); }
.brand-mini .dot-orange { background: var(--tc-orange-500); margin-left: -4px; }

.btn-newchat {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin: 8px 12px 12px;
  padding: 11px 14px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--tc-orange-500), var(--tc-orange-400));
  color: #fff; font-weight: 600;
  border: none;
  box-shadow: 0 8px 18px rgba(249,115,22,.28);
}
.btn-newchat:hover { filter: brightness(1.08); color: #fff; }

.sidebar-section-title {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .12em;
  color: #7fa092; padding: 6px 18px;
}
.chats-list { flex: 1 1 auto; overflow-y: auto; padding: 4px 8px; }
.chat-item {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 10px;
  border-radius: 10px;
  cursor: pointer;
  color: #d3e7df;
  transition: background .15s;
  position: relative;
}
.chat-item:hover { background: #14342c; }
.chat-item.active { background: linear-gradient(90deg, #1a4a3e, #14342c); color: #fff; }
.chat-item .chat-title { flex: 1; min-width: 0; font-size: .93rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item .chat-del {
  border: none; background: transparent; color: #7fa092; opacity: 0;
  transition: opacity .15s, color .15s;
  padding: 4px 6px; border-radius: 6px;
}
.chat-item:hover .chat-del, .chat-item.active .chat-del { opacity: 1; }
.chat-item .chat-del:hover { color: #fda4af; background: rgba(255,255,255,.06); }

.quota-card {
  margin: 10px 12px;
  background: rgba(255,255,255,.04);
  border: 1px solid #163a31;
  border-radius: 12px;
  padding: 10px 12px;
}
.quota-label { font-size: .78rem; color: #a8c1b6; }
.quota-pill { font-size: .78rem; color: #fff; background: var(--tc-orange-500); padding: 2px 8px; border-radius: 999px; font-weight: 600; }
.quota-bar { height: 6px; background: #14342c; }
.quota-bar .progress-bar { background: linear-gradient(90deg, var(--tc-green-500), var(--tc-orange-500)); }

.sidebar-footer { padding: 10px 12px 14px; border-top: 1px solid #163a31; }
.user-block { display: flex; align-items: center; gap: 10px; }
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--tc-green-500), var(--tc-orange-500));
  color: #fff; display: grid; place-items: center; font-weight: 700; flex-shrink: 0;
}
.user-name { font-size: .9rem; color: #fff; font-weight: 600; }
.user-role { font-size: .75rem; color: #a8c1b6; }

.btn-icon {
  background: transparent; border: none; color: #a8c1b6;
  width: 36px; height: 36px; border-radius: 8px;
  display: grid; place-items: center;
}
.btn-icon:hover { background: rgba(255,255,255,.06); color: #fff; }

.sidebar-backdrop {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 1030;
}
.sidebar-backdrop.show { display: block; }

/* Main */
.main { display: flex; flex-direction: column; height: 100vh; min-width: 0; background: var(--tc-bg); }
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--tc-border);
  background: var(--tc-surface);
}
.topbar .btn-icon { color: var(--tc-text-muted); }
.topbar .btn-icon:hover { background: var(--tc-green-50); color: var(--tc-green-700); }
.topbar-title { font-size: 1.05rem; font-weight: 700; margin: 0; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--tc-green-900); }
.topbar-meta { font-size: .8rem; color: var(--tc-text-muted); }

.messages {
  flex: 1 1 auto; overflow-y: auto; padding: 24px 18px 12px;
  scroll-behavior: smooth;
}
.msg-wrap { max-width: 820px; margin: 0 auto 18px; }
.msg { display: flex; gap: 12px; }
.msg .avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 700; color: #fff; flex-shrink: 0;
  font-size: .85rem;
}
.msg-user .avatar { background: linear-gradient(135deg, #475569, #64748b); }
.msg-assistant .avatar { background: linear-gradient(135deg, var(--tc-green-600), var(--tc-orange-500)); }
.clarification-question { margin-bottom: .7rem; font-weight: 600; }
.clarification-options { display: flex; flex-wrap: wrap; gap: .5rem; }
.clarification-choice { text-align: left; white-space: normal; }
.clarification-custom { display: flex; gap: .5rem; margin-top: .65rem; max-width: 38rem; }
.clarification-cancel { padding-left: 0; color: var(--bs-secondary-color); }
.msg .body { flex: 1; min-width: 0; }
.msg .role { font-size: .78rem; color: var(--tc-text-muted); margin-bottom: 4px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.msg-content {
  background: var(--tc-surface);
  border: 1px solid var(--tc-border);
  border-radius: var(--tc-radius);
  padding: 14px 16px;
  line-height: 1.6;
  font-size: .98rem;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
.msg-user .msg-content { background: linear-gradient(135deg, #ecfdf5, #fff7ed); border-color: #e7f1ec; }
.msg-content > *:first-child { margin-top: 0; }
.msg-content > *:last-child { margin-bottom: 0; }
.msg-content pre { background: #0c1f1a; color: #e6ede9; padding: 12px 14px; border-radius: 10px; overflow-x: auto; font-size: .85rem; }
.msg-content code { background: #f1f5f3; padding: 1px 6px; border-radius: 5px; font-size: .88em; color: var(--tc-green-700); }
.msg-content pre code { background: transparent; padding: 0; color: inherit; }
.msg-content table { border-collapse: collapse; width: 100%; font-size: .88rem; margin: 8px 0; }
.msg-content table th, .msg-content table td { border: 1px solid var(--tc-border); padding: 6px 10px; text-align: left; }
.msg-content table th { background: var(--tc-green-50); color: var(--tc-green-900); }

.attachment {
  margin-top: 10px;
  border: 1px solid var(--tc-border);
  border-radius: 12px;
  overflow: hidden;
  background: #fafdfc;
}
.attachment-head {
  padding: 8px 12px;
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(90deg, var(--tc-green-50), #fff7ed);
  border-bottom: 1px solid var(--tc-border);
  font-size: .85rem; font-weight: 600; color: var(--tc-green-900);
}
.attachment-head .btn-dl {
  border: none; background: var(--tc-green-600); color: #fff; padding: 4px 10px; border-radius: 6px; font-size: .8rem; font-weight: 600;
}
.attachment-head .btn-dl:hover { background: var(--tc-green-700); }
.attachment-body { max-height: 360px; overflow: auto; padding: 8px 12px; }
.attachment iframe { width: 100%; min-height: 480px; border: none; display: block; background: #fff; }

.empty-state {
  max-width: 720px; margin: 60px auto; text-align: center; color: var(--tc-text-muted);
}
.empty-state h2 { color: var(--tc-green-900); font-weight: 800; letter-spacing: -.02em; }
.suggest-grid { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; margin-top: 20px; }
@media (max-width: 600px) { .suggest-grid { grid-template-columns: 1fr; } }
@media (max-width: 600px) {
  .topbar { gap: 7px; padding: 9px 10px; }
  .topbar-title { font-size: .98rem; }
  .topbar-meta { display:none; }
  .messages { padding: 14px 10px 8px; }
  .msg { gap: 8px; }
  .msg .avatar { width: 28px; height: 28px; }
  .msg-content { padding: 11px 12px; font-size: .94rem; }
  .composer-wrap { padding: 9px 10px max(10px, env(safe-area-inset-bottom)); }
  .composer { gap: 5px; }
  .composer-input { min-width:0; }
  .artifact-head { align-items:flex-start; gap:8px; flex-direction:column; }
  .artifact-actions { gap:5px; }
  .artifact-actions button { padding:5px 8px; }
  .attachment iframe { min-height: 360px; }
}
.suggest-card {
  background: var(--tc-surface); border: 1px solid var(--tc-border);
  border-radius: 12px; padding: 14px; text-align: left;
  cursor: pointer; transition: all .15s;
}
.suggest-card:hover { border-color: var(--tc-green-500); box-shadow: var(--tc-shadow); transform: translateY(-1px); }
.suggest-card b { color: var(--tc-green-900); }
.suggest-card span { color: var(--tc-text-muted); font-size: .85rem; }

.composer-wrap { padding: 12px 18px 18px; border-top: 1px solid var(--tc-border); background: var(--tc-surface); }
.composer {
  max-width: 820px; margin: 0 auto;
  background: #fff; border: 1px solid var(--tc-border); border-radius: 16px;
  display: flex; align-items: flex-end; gap: 8px; padding: 8px 8px 8px 14px;
  box-shadow: 0 6px 18px rgba(6,78,59,.06);
  transition: border-color .15s, box-shadow .15s;
}
.composer:focus-within { border-color: var(--tc-green-500); box-shadow: 0 0 0 .2rem rgba(16,185,129,.15); }
.composer-input {
  flex: 1; border: none; outline: none; resize: none;
  font-size: 1rem; padding: 10px 4px; max-height: 200px; font-family: inherit;
  background: transparent;
}
.btn-send {
  width: 38px; height: 38px; border-radius: 10px;
  background: linear-gradient(135deg, var(--tc-green-600), var(--tc-orange-500));
  color: #fff; border: none; flex-shrink: 0;
  display: grid; place-items: center; font-size: 1.1rem;
}
.btn-send:disabled { opacity: .4; cursor: not-allowed; }
.btn-send:hover:not(:disabled) { filter: brightness(1.08); }
.composer-foot { max-width: 820px; margin: 6px auto 0; display: flex; justify-content: space-between; }

.typing { display: inline-flex; gap: 4px; align-items: center; }
.typing span {
  width: 6px; height: 6px; border-radius: 50%; background: var(--tc-green-600);
  animation: typing 1.2s infinite ease-in-out;
}
.typing span:nth-child(2) { animation-delay: .15s; background: var(--tc-orange-500); }
.typing span:nth-child(3) { animation-delay: .3s; background: var(--tc-green-600); }
@keyframes typing { 0%,80%,100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.toast-error {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: #dc2626; color: #fff; padding: 10px 18px; border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.2); z-index: 2000; font-size: .9rem;
}

/* Additions for the Node version, using the existing Transcolar theme. */
.hidden { display:none !important; }
.login-screen { width:100%; display:grid; place-items:center; }
.login-card .brand-sub { max-width:280px; }
button.chat-item { width:100%; border:0; background:transparent; text-align:left; }
button.chat-item.active { background:linear-gradient(90deg,#1a4a3e,#14342c); }
button.chat-item:hover { background:#14342c; }
.btn-memory { display:flex; align-items:center; gap:9px; margin:10px 12px; padding:12px; border:1px solid #24483b; border-radius:12px; color:#c1d9ce; background:rgba(255,255,255,.04); font-size:.85rem; }
.btn-memory:hover { color:#fff; background:#14342c; }
.suggest-card { color:inherit; font:inherit; }
.file-pill { display:flex; align-items:center; gap:8px; max-width:820px; margin:0 auto 8px; padding:8px 12px; border:1px solid var(--tc-border); border-radius:10px; background:var(--tc-green-50); color:var(--tc-green-900); font-size:.85rem; overflow-wrap:anywhere; }
:is(#memoryModal,#ragModal) { border:1px solid var(--tc-border); border-radius:18px; width:min(520px,calc(100% - 32px)); max-height:90dvh; padding:0; color:var(--tc-text); box-shadow:0 20px 70px #0003; }
:is(#memoryModal,#ragModal)::backdrop { background:rgba(10,31,26,.5); }
:is(#memoryModal,#ragModal) .modal-header,:is(#memoryModal,#ragModal) .modal-body,:is(#memoryModal,#ragModal) .modal-footer { padding:18px 22px; }
:is(#memoryModal,#ragModal) .modal-header { border-bottom:1px solid var(--tc-border); }
:is(#memoryModal,#ragModal) .modal-footer { border-top:1px solid var(--tc-border); }
.notification { position:fixed; bottom:24px; left:50%; transform:translateX(-50%); background:var(--tc-green-900); color:#fff; padding:12px 18px; border-radius:10px; z-index:2100; box-shadow:var(--tc-shadow); max-width:calc(100% - 32px); }
.msg-content { overflow-x:auto; }
:focus-visible { outline:2px solid var(--tc-green-500); outline-offset:3px; }
@media(max-width:600px) { .composer-foot { gap:8px; font-size:.75rem; } .empty-state { margin:30px auto; } }

.composer-input { min-width:0; }
.composer .btn-icon { color:var(--tc-text-muted); }
.composer .btn-icon:hover { color:var(--tc-green-700); background:var(--tc-green-50); }

.artifact-actions { display:flex; gap:6px; flex-wrap:wrap; }
.artifact-actions button { border:1px solid #b9d3c3; background:#fff; color:#1b5e20; border-radius:6px; padding:4px 9px; font-size:.8rem; cursor:pointer; }
.artifact-actions button:disabled { opacity:.5; cursor:wait; }
.message-exports { margin-top:14px; }
.export-status { padding:4px 10px; overflow-wrap:anywhere; }
.attachment-body svg { max-width:100%; height:auto; }
.artifact-frame { padding:0; max-height:none; }
.export-page { position:absolute; left:-12000px; top:0; width:900px; padding:28px; color:#172b20; background:#fff; font:16px system-ui; }
.export-page table { border-collapse:collapse; width:100%; }
.export-page td,.export-page th { border:1px solid #aaa; padding:6px; }
.katex-display { overflow-x:auto; overflow-y:hidden; }
.attachment-head { gap:8px; flex-wrap:wrap; }
.msg-content pre:has(code.hljs) { background:#f6f8fa; color:#24292f; }

/* Persistent activity indicator, respecting reduced motion. */
#typingMsg .msg-content { position:relative; overflow:hidden; }
#typingMsg .msg-content::after { content:''; display:block; height:3px; margin-top:12px; border-radius:3px; background:linear-gradient(90deg,transparent,#10b981,#f97316,transparent); background-size:200% 100%; animation:analysis-flow 2s linear infinite; }
.btn-send.is-processing { background:var(--tc-green-700); color:#fff; }
@keyframes analysis-flow { from {background-position:200% 0} to {background-position:0 0} }
@media(prefers-reduced-motion:reduce) { #typingMsg .msg-content::after,.typing span { animation:none; } }

/* Interface: quiet surfaces, clear hierarchy and comfortable touch targets. */
:root {
  --tc-bg:#f8faf9;
  --tc-border:#e2e9e5;
  --tc-text:#203a30;
  --tc-text-muted:#65776e;
  --tc-radius:20px;
  --tc-shadow:0 16px 44px #153e2410;
}
.app-body,.app-shell,.main,.sidebar { height:100dvh; }
.app-shell { grid-template-columns:272px minmax(0,1fr); }
.main { background:radial-gradient(ellipse at 60% 0%,#edf6ef80,transparent 55%),var(--tc-bg); }
.sidebar { background:#102c24; border-right:0; padding:10px 8px 0; }
.sidebar-header { padding:18px 16px 24px; }
.brand-mini { gap:7px; }
.brand-mini-name { font-size:1.08rem; margin-left:5px; letter-spacing:-.04em; }
.btn-newchat { background:#e4f1e9; color:#153f2b; box-shadow:none; border:1px solid #ffffff30; margin:0 8px 26px; padding:13px 16px; justify-content:flex-start; border-radius:13px; font-size:.88rem; }
.btn-newchat:hover { background:#fff; color:#153f2b; }
.btn-newchat i { margin-right:4px; }
.sidebar-section-title { font-size:.65rem; letter-spacing:.13em; color:#9bb6a9; padding:0 16px 10px; }
.chats-list { padding:0 6px; scrollbar-width:thin; scrollbar-color:#466254 transparent; }
.chat-item { margin-bottom:4px; min-height:44px; border:1px solid transparent; padding:10px 12px; }
.chat-item .chat-title { font-size:.82rem; }
.chat-item > i { font-size:.88rem; color:#99b5a6; }
.chat-item.active { background:#244b3b; border-color:#42664f; }
.chat-item.active::before { content:''; position:absolute; width:3px; height:16px; left:0; border-radius:2px; background:#f5ac63; }
.quota-card { margin:14px 8px 8px; background:#ffffff05; border-color:#ffffff14; padding:13px; }
.quota-pill { background:#ffffff12; color:#d8e6dd; font-size:.72rem; }
.quota-bar { height:4px; margin-top:10px; }
.quota-bar .progress-bar { background:#8fc7a5; }
.sidebar .text-muted { color:#9cb4a8!important; }
.btn-memory { margin:3px 8px; padding:12px; border:0; background:transparent; font-size:.8rem; }
.btn-memory > i:first-child { color:#9bbca6; font-size:1rem; }
.sidebar-footer { margin-top:12px; padding:16px 10px; border-top-color:#ffffff14; }
.user-avatar { border-radius:12px; background:#355d48; width:38px; height:38px; font-size:.85rem; }
.user-name { font-size:.82rem; }
.user-role { font-size:.69rem; }
.topbar { min-height:76px; padding:16px 32px; gap:12px; background:#ffffffd9; }
.topbar-title { font-size:.95rem; font-weight:600; letter-spacing:-.02em; }
.topbar-meta { font-size:.7rem; background:#edf2ef; border-radius:8px; padding:5px 9px; white-space:nowrap; }
#backgroundStatus { font-size:.7rem; max-width:210px; }
#backgroundStatus:empty { display:none; }
#toolHistoryControl { font-size:.7rem; padding-left:2.5em; color:var(--tc-text-muted); }
.messages { min-height:0; padding:36px 32px 20px; scrollbar-width:thin; scrollbar-color:#d1ddd5 transparent; }
.msg-wrap { max-width:880px; margin-bottom:30px; }
.msg { gap:14px; }
.msg .avatar { border-radius:12px; width:34px; height:34px; font-size:.7rem; }
.msg-assistant .avatar { background:#1e6544; box-shadow:inset 0 0 0 1px #ffffff30; }
.msg-user .avatar { background:#e1e9e4; color:#536c5e; }
.msg .role { text-transform:none; letter-spacing:0; font-size:.72rem; font-weight:600; margin:0 0 9px; }
.msg-content { padding:20px 22px; font-size:.94rem; line-height:1.8; border-color:#e4ebe6; box-shadow:0 3px 12px #153e2403; border-radius:0 18px 18px 18px; }
.msg-user .msg-content { background:#edf4ee; border-color:#e0ebe2; box-shadow:none; }
.msg-content h2,.msg-content h3 { letter-spacing:-.025em; line-height:1.4; }
.msg-content table th { background:#f0f6f1; }
.msg-content table td,.msg-content table th { padding:10px 12px; }
#typingMsg .msg-content { background:transparent; border:0; box-shadow:none; padding:9px 0; }
#typingMsg .msg-content::after { max-width:190px; height:2px; opacity:.65; }
#typingMsg [role=status] { font-size:.86rem; margin-left:7px; }
.empty-state { max-width:740px; margin:clamp(24px,7vh,90px) auto 30px; }
.welcome-symbol { display:grid; place-items:center; margin:0 auto 22px; width:64px; height:64px; border-radius:21px; color:#2b754e; background:#e5f0e8; border:1px solid #d7e8da; font-size:1.65rem; transform:rotate(-5deg); }
.welcome-symbol i { transform:rotate(5deg); }
.welcome-eyebrow { display:block; color:#718678; font-size:.62rem; font-weight:700; letter-spacing:.16em; margin-bottom:14px; }
.empty-state h2 { font-weight:600; font-size:clamp(1.7rem,3vw,2.5rem); letter-spacing:-.055em; line-height:1.2; margin-bottom:16px; color:#244c35; }
.empty-state > p { font-size:.88rem; line-height:1.9; color:#738177; }
.suggest-grid { gap:12px; margin-top:32px; }
.suggest-card { display:flex; flex-direction:column; gap:10px; background:#ffffffc9; padding:20px; border-radius:16px; border-color:#e0e8e2; }
.suggest-heading { display:flex; justify-content:space-between; align-items:center; gap:12px; }
.suggest-card .suggest-heading { font-size:.83rem; }
.suggest-heading i { color:#7b9984; }
.suggest-card > span:last-child { font-size:.78rem; line-height:1.65; }
.suggest-card:hover { border-color:#8fba9e; background:#fff; box-shadow:0 8px 24px #163e2410; }
.topbar,.composer-wrap { flex-shrink:0; }
.composer-wrap { border:0; background:linear-gradient(0deg,var(--tc-bg) 75%,transparent); padding:16px 32px 20px; }
.composer { max-width:880px; border-radius:22px; padding:10px; align-items:flex-end; border-color:#d6e1d8; box-shadow:0 8px 32px #183c2110; }
.composer:focus-within { border-color:#80ac8f; box-shadow:0 8px 32px #183c2110,0 0 0 3px #80ac8f1c; }
.composer-input { font-size:.93rem; line-height:1.6; padding:10px 4px; }
.composer-input::placeholder { color:#8b998f; }
.composer .btn-icon { width:40px; height:44px; border-radius:13px; }
.btn-send { width:44px; height:44px; border-radius:14px; background:#236445; box-shadow:0 3px 6px #163e2415; }
.btn-send:hover:not(:disabled) { background:#194d33; }
.btn-send.is-processing { background:#f8ede1; color:#8a4e1d; border:1px solid #e9d2b9; }
.composer-foot { max-width:880px; gap:16px; margin-top:10px; align-items:center; padding:0 8px; }
.composer-foot .small,.composer-hint { font-size:.65rem; color:#829086; line-height:1.5; }
#selectedFile { max-width:880px; margin:auto; padding:6px 12px; border-radius:12px; background:#eaf2ec; }
.login-body { background:radial-gradient(ellipse at 10% 0%,#e0eee2,transparent 55%),radial-gradient(ellipse at 100% 100%,#f5e7d5,transparent 50%),#f8faf7; }
.login-shell { max-width:460px; }
.login-card { padding:36px; border-radius:28px; border-color:#ffffff; box-shadow:0 24px 80px #23452d12; }
.brand-mark { width:44px; height:44px; border-radius:14px; background:#276344; box-shadow:none; }
.brand-name { font-size:1.3rem; font-weight:700; letter-spacing:-.05em; }
.brand-sub { font-size:.72rem; line-height:1.5; }
.login-intro { margin-top:34px; }
.login-intro h2 { color:#244c35; font-size:2rem; font-weight:600; letter-spacing:-.05em; line-height:1.2; }
.login-intro p { color:var(--tc-text-muted); font-size:.83rem; margin-top:14px; }
.login-card .form-label { font-size:.78rem; font-weight:600; }
.login-card .form-control,.login-card .form-select { border-radius:11px; font-size:.9rem; min-height:48px; background-color:#fafcfb; }
.login-card .btn-primary { background:#246344; box-shadow:none; border-radius:12px; min-height:49px; font-size:.92rem; }
.login-foot { font-size:.73rem; line-height:1.6; }
.login-credit { font-size:.65rem; }
.sidebar-backdrop { background:#0c241c80; backdrop-filter:blur(4px); }
@media(min-width:1600px) { .app-shell { grid-template-columns:300px minmax(0,1fr); } }
@media(max-width:991px) {
  .app-shell { grid-template-columns:minmax(0,1fr); }
  .sidebar { max-width:310px; }
  .topbar { padding:12px 20px; min-height:66px; }
  .chat-item .chat-del { opacity:1; min-width:32px; min-height:32px; }
}
@media(max-width:600px) {
  .topbar { padding:10px 14px; gap:8px; min-height:62px; }
  .topbar-title { font-size:.9rem; flex-basis:calc(100% - 52px); }
  #backgroundStatus { max-width:none; padding-left:44px; flex:1; font-size:.65rem; }
  #toolHistoryControl { margin-left:auto; font-size:.65rem; }
  .messages { padding:24px 14px 10px; }
  .msg { gap:9px; }
  .msg .avatar { width:27px; height:27px; border-radius:9px; font-size:.58rem; }
  .msg .role { font-size:.68rem; margin-bottom:7px; }
  .msg-content { padding:15px; font-size:.91rem; line-height:1.75; }
  .msg-wrap { margin-bottom:24px; }
  .empty-state { margin:26px auto; }
  .welcome-symbol { width:54px; height:54px; border-radius:18px; margin-bottom:18px; }
  .empty-state h2 { font-size:1.85rem; }
  .empty-state > p { font-size:.8rem; padding:0 12px; }
  .suggest-grid { grid-template-columns:1fr; gap:10px; margin-top:24px; }
  .suggest-card { padding:16px 18px; gap:7px; }
  .composer-wrap { padding:12px 12px max(12px,env(safe-area-inset-bottom)); }
  .composer { padding:7px; gap:4px; border-radius:20px; }
  .composer-input { font-size:16px; padding:10px 0; }
  .composer .btn-icon { width:34px; }
  .composer-foot { padding:0 4px; margin-top:8px; }
  .composer-hint { display:none; }
  .login-card { padding:28px 24px; }
  .login-intro h2 { font-size:1.8rem; }
}
@media(prefers-reduced-motion:reduce) {
  *,*::before,*::after { scroll-behavior:auto!important; transition:none!important; animation:none!important; }
}

/* Interactive report tables and export controls. */
.report-table{border:1px solid var(--report-border);border-radius:14px;overflow:hidden;background:#fff;margin:16px 0}.table-tools,.table-pager{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 14px;font-size:12px;color:#697c6e}.table-tools{border-bottom:1px solid var(--report-border)}.table-tools input{min-width:0;width:min(260px,65%);border:1px solid #dce5df;border-radius:9px;padding:8px 11px;font:inherit;background:#f8faf8;color:#243e30}.table-scroll{overflow-x:auto;max-height:520px}.table-pager{border-top:1px solid var(--report-border)}table{border-collapse:collapse;width:100%;font-size:13px;margin:0!important}th,td{padding:12px 14px!important;text-align:left;border:0!important;border-bottom:1px solid #edf1ee!important;white-space:normal}th{background:#edf4ef;color:#315e40;position:sticky;top:0}th button{border:0;background:transparent;padding:0;text-align:left;color:inherit;font-weight:600}tbody tr:nth-child(even){background:#fafcfb}tbody tr:hover{background:#f0f6f1}

.attachment { margin-top:20px; border-radius:18px; border-color:#dce6df; box-shadow:0 6px 24px #1a432309; }
.attachment-head { background:#f2f7f3; padding:14px 16px; gap:14px; }
.attachment-head > span { font-size:.8rem; font-weight:700; letter-spacing:-.01em; }
.artifact-actions { gap:8px; }
.artifact-actions button,.attachment-head .btn-dl { display:inline-flex; align-items:center; justify-content:center; gap:5px; border:1px solid #d6e3d9; border-radius:9px; padding:8px 12px; color:#326147; background:#fff; font-size:.73rem; font-weight:600; min-height:34px; transition:background .15s,border-color .15s; }
.artifact-actions button:hover,.attachment-head .btn-dl:hover { background:#eaf3ed; border-color:#9dbea8; color:#204d34; }
.attachment-body { max-height:620px; padding:16px; }
.artifact-frame { max-height:none; padding:0; }
.artifact-frame iframe { min-height:560px; }
.export-status:not(:empty) { padding:10px 16px; background:#f7faf8; border-top:1px solid #e5ece7; font-size:.73rem; }
.export-status:empty { display:none; }
.message-exports { padding-top:16px; border-top:1px solid #edf1ee; margin-top:22px; }
.export-text h1,.export-text h2 { color:#245438; letter-spacing:-.035em; }
@media(max-width:600px) { .attachment-head { padding:12px; }.artifact-actions button,.attachment-head .btn-dl { padding:8px 10px; min-height:38px; }.attachment-body { padding:10px; }.artifact-frame { padding:0; }.artifact-frame iframe { min-height:500px; }.table-tools { flex-wrap:wrap; }.table-tools input { width:100%; }.table-pager { font-size:11px; padding:10px; gap:5px; } }
@media print { .table-tools,.table-pager { display:none!important; }.report-table tr[hidden] { display:table-row!important; }.table-scroll { max-height:none!important;overflow:visible!important; } }

/* Print the open conversation, including content below the scroll viewport. */
@media print {
  @page { margin:14mm; }
  html,body,body.app-body {
    height:auto!important;
    min-height:0!important;
    overflow:visible!important;
    background:#fff!important;
    color:#172d21!important;
  }
  #loginScreen,.sidebar,.topbar,.composer-wrap,.sidebar-backdrop,
  dialog,.modal,.modal-backdrop,.notification,.toast-error,
  #typingMsg,.empty-state,.artifact-actions,.export-status,
  .table-tools,.table-pager {
    display:none!important;
  }
  #app:not(.hidden),.main,.messages {
    display:block!important;
    height:auto!important;
    min-height:0!important;
    max-height:none!important;
    width:100%!important;
    overflow:visible!important;
    padding:0!important;
    margin:0!important;
    background:#fff!important;
  }
  .msg-wrap { max-width:none; margin:0 0 20px; }
  .msg { display:block; }
  .msg .avatar { display:none; }
  .msg .role { color:#284b35; margin:0 0 6px; font-size:9pt; }
  .msg-content,.msg-user .msg-content {
    border:0;
    border-bottom:1px solid #dce5de;
    border-radius:0;
    background:#fff;
    box-shadow:none;
    padding:0 0 16px;
    overflow:visible!important;
    font-size:10pt;
    line-height:1.6;
  }
  .attachment,.report-table { box-shadow:none; overflow:visible!important; }
  .attachment-body,.table-scroll,.katex-display {
    max-height:none!important;
    overflow:visible!important;
  }
  .attachment-head { background:#fff; }
  .msg-content table { width:100%; font-size:9pt; table-layout:auto; }
  .report-table tr[hidden] { display:table-row!important; }
  th { position:static!important; }
  thead { display:table-header-group; }
  tr,img,svg { break-inside:avoid; }
  h1,h2,h3,h4,.msg .role { break-after:avoid; }
  p { orphans:3; widows:3; }
  .msg-content pre { white-space:pre-wrap; overflow-wrap:anywhere; }
  .msg-content img,.msg-content svg { max-width:100%; }
}

/* Conversation organization, evidence and operations. */
.history-search { padding:0 10px 14px; }
.history-search input { width:100%; min-width:0; border:1px solid #42614e; background:#ffffff09; color:#fff; padding:9px 12px; border-radius:10px; font-size:.78rem; }
.history-search input::placeholder { color:#a6bcaf; }
.template-picker { display:flex; align-items:center; justify-content:flex-end; gap:10px; max-width:880px; margin:0 auto 9px; font-size:.68rem; color:#607769; }
.template-picker select { border:1px solid #dce6df; border-radius:8px; padding:6px 10px; background:#fff; color:#2b5a3d; max-width:45%; }
.report-evidence { margin:18px 0 6px; padding:12px 15px; border:1px solid #dce8df; border-radius:12px; background:#f6faf7; font-size:.75rem; color:#4e6857; }
.report-evidence summary { cursor:pointer; font-weight:600; }
.report-evidence p { margin:8px 0 0; }
.recovery-card { max-width:880px; margin:18px auto; background:#fff8ed; border:1px solid #edd7b9; border-radius:14px; padding:18px; font-size:.85rem; }
#favoriteChat[aria-pressed=true] { color:#bd7929; }
#healthModal { border:1px solid var(--tc-border); border-radius:18px; width:min(650px,calc(100% - 32px)); max-height:90dvh; padding:0; color:var(--tc-text); box-shadow:0 20px 70px #0003; }
#healthModal::backdrop { background:#102c2477; }
#healthModal .modal-header,#healthModal .modal-body,#healthModal .modal-footer { padding:18px 22px; }
#healthModal .modal-body { overflow:auto; }
#healthModal .modal-body p { padding:9px 12px; background:#f1f6f2; border-radius:8px; font-size:.85rem; }
.report-print-heading { border-bottom:2px solid #246344; padding-bottom:10px; margin-bottom:20px; }
.report-print-heading p { font-size:9pt; color:#647568; }
@media(max-width:600px) { .topbar-title { flex-basis:calc(100% - 192px); } .topbar > .btn-icon { width:30px; height:36px; } .template-picker { font-size:.65rem; } }
@media print {
  .recovery-card,.template-picker { display:none!important; }
  .report-evidence > :not(summary) { display:block!important; }
  .report-evidence { break-inside:avoid; }
  @page { @bottom-right { content:'Página ' counter(page) ' de ' counter(pages);font-size:8pt; } }
}
@media print {
 .messages::before { content:attr(data-print-title);display:block;font-size:14pt;font-weight:700;color:#245438;border-bottom:2px solid #245438;margin-bottom:18px;padding-bottom:10px; }
 .artifact-frame iframe { height:var(--report-print-height,720px)!important;max-height:none!important; }
}
