:root {
  --ink: #13231d;
  --forest: #173d31;
  --forest-2: #245846;
  --cream: #f3efe5;
  --paper: #fbf8f0;
  --gold: #c49b55;
  --rust: #a64e35;
  --line: rgba(19, 35, 29, .16);
  --muted: #6f776f;
  --shadow: 0 22px 70px rgba(22, 43, 34, .14);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--cream); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--cream);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .22;
  z-index: 20;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.08'/%3E%3C/svg%3E");
}

h1, h2, h3, h4, p { margin-top: 0; }
h1, h2, h3, .display { font-family: Georgia, "Times New Roman", serif; font-weight: 400; }
em { color: var(--gold); font-weight: 400; }
.eyebrow, .kicker {
  margin-bottom: 10px;
  color: var(--gold);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .18em;
  text-transform: uppercase;
}
.primary {
  border: 0;
  border-radius: 2px;
  padding: 13px 18px;
  color: #fff;
  background: var(--forest);
  font-weight: 750;
  box-shadow: 0 8px 20px rgba(23, 61, 49, .18);
  transition: transform .2s, background .2s;
}
.primary:hover { transform: translateY(-1px); background: var(--forest-2); }
.primary:disabled { opacity: .55; cursor: wait; transform: none; }
.primary span { margin-left: 18px; }
.full { width: 100%; }

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(360px, .6fr);
  background: var(--forest);
}
.login-copy {
  min-height: 100vh;
  padding: clamp(50px, 8vw, 120px);
  color: white;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.login-copy::after {
  content: "T";
  position: absolute;
  right: -2vw;
  bottom: -18vh;
  color: rgba(255,255,255,.025);
  font-family: Georgia, serif;
  font-size: 70vh;
  line-height: 1;
}
.login-copy h1 { margin: 10px 0 25px; font-size: clamp(62px, 8vw, 128px); line-height: .86; letter-spacing: -.055em; }
.lead { max-width: 620px; color: rgba(255,255,255,.67); font-size: 19px; line-height: 1.6; }
.principles { display: flex; gap: 28px; margin-top: 54px; color: rgba(255,255,255,.5); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; }
.login-panel {
  padding: 70px clamp(35px, 5vw, 80px);
  background: var(--paper);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.login-panel .seal {
  width: 58px; height: 58px; margin-bottom: 38px; display: grid; place-items: center;
  color: var(--gold); border: 1px solid var(--gold); border-radius: 50%;
  font-family: Georgia, serif; font-size: 17px; letter-spacing: .08em;
}
.login-panel h2 { margin-bottom: 32px; font-size: 39px; }
label { display: block; margin: 15px 0 8px; font-size: 12px; font-weight: 750; }
input, textarea {
  width: 100%; padding: 13px 14px; color: var(--ink); background: rgba(255,255,255,.5);
  border: 1px solid var(--line); border-radius: 2px; outline: none;
}
input:focus, textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(196,155,85,.12); }
.login-panel input { margin-bottom: 16px; }
.form-error { min-height: 18px; margin: 10px 0 0; color: var(--rust); font-size: 12px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 238px 1fr; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: 238px; padding: 32px 22px 24px;
  color: white; background: var(--forest); display: flex; flex-direction: column; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 12px; color: white; text-decoration: none; font-family: Georgia, serif; font-size: 18px; line-height: .9; }
.brand small { color: var(--gold); font-family: Inter, sans-serif; font-size: 9px; letter-spacing: .18em; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--gold); border-radius: 50%; color: var(--gold); font-size: 20px; }
.sidebar nav { display: grid; gap: 5px; margin-top: 64px; }
.nav-item {
  padding: 12px 11px; color: rgba(255,255,255,.57); background: transparent; border: 0; border-radius: 3px;
  text-align: left; font-size: 13px; font-weight: 650;
}
.nav-item:hover, .nav-item.active { color: white; background: rgba(255,255,255,.08); }
.nav-icon { display: inline-block; width: 28px; color: var(--gold); }
.sidebar-foot { margin-top: auto; }
.system-mini { display: flex; gap: 8px; align-items: center; color: rgba(255,255,255,.52); font-size: 10px; }
.system-mini i { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); }
.system-mini.ok i { background: #65bd7c; box-shadow: 0 0 9px #65bd7c; }
.text-button { margin: 18px 0 0; padding: 0; border: 0; color: rgba(255,255,255,.42); background: none; font-size: 11px; }
.workspace { grid-column: 2; min-width: 0; }
.topbar {
  min-height: 116px; padding: 27px clamp(28px, 5vw, 76px); background: rgba(251,248,240,.74);
  border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between;
  backdrop-filter: blur(15px); position: sticky; top: 0; z-index: 4;
}
.topbar h2 { margin: 0; font-size: 29px; }
.page { padding: 58px clamp(28px, 5vw, 76px) 90px; }
.intro-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 60px; align-items: end; padding-bottom: 42px; border-bottom: 1px solid var(--line); }
.intro-grid h3 { margin: 0; font-size: clamp(34px, 4vw, 58px); line-height: 1.02; letter-spacing: -.035em; }
.intro-grid p { margin: 0; color: var(--muted); line-height: 1.65; }
.sessions-list { margin-top: 28px; display: grid; gap: 10px; }
.session-row {
  display: grid; grid-template-columns: 60px 1fr auto; gap: 18px; align-items: center; padding: 20px;
  background: rgba(255,255,255,.38); border: 1px solid transparent; border-bottom-color: var(--line);
  transition: .2s; cursor: pointer;
}
.session-row:hover { transform: translateX(3px); border-color: var(--line); background: var(--paper); box-shadow: 0 8px 30px rgba(22,43,34,.06); }
.session-index { font-family: Georgia, serif; color: var(--gold); font-size: 23px; }
.session-row h4 { margin: 0 0 6px; font-family: Georgia, serif; font-size: 21px; }
.session-meta { color: var(--muted); font-size: 11px; }
.status-pill { padding: 6px 9px; border: 1px solid var(--line); border-radius: 30px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.status-pill.ready { color: var(--forest-2); border-color: rgba(36,88,70,.3); }
.status-pill.error { color: var(--rust); border-color: rgba(166,78,53,.3); }
.empty-state { padding: 65px 24px; color: var(--muted); text-align: center; border: 1px dashed var(--line); }
.empty-state strong { display: block; margin-bottom: 8px; color: var(--ink); font-family: Georgia, serif; font-size: 24px; font-weight: 400; }

dialog { width: min(810px, calc(100vw - 30px)); padding: 0; border: 0; background: var(--paper); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(9,25,19,.72); backdrop-filter: blur(4px); }
dialog form { padding: clamp(25px, 5vw, 52px); }
.dialog-head { display: flex; justify-content: space-between; }
.dialog-head h2 { font-size: 39px; }
.icon-button { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 50%; background: transparent; font-size: 22px; }
.upload-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; margin: 22px 0; }
.drop-zone { min-height: 170px; margin: 0; padding: 20px; border: 1px dashed rgba(19,35,29,.25); display: flex; flex-direction: column; cursor: pointer; }
.drop-zone:hover { border-color: var(--gold); background: rgba(196,155,85,.05); }
.drop-zone input { position: absolute; opacity: 0; pointer-events: none; }
.drop-zone strong { margin-top: 17px; font-family: Georgia, serif; font-size: 20px; }
.drop-zone small { margin-top: 7px; color: var(--muted); line-height: 1.4; }
.upload-number { color: var(--gold); font-size: 10px; letter-spacing: .13em; }
.file-name { margin-top: auto; overflow: hidden; color: var(--forest-2); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
details { margin-top: 22px; border-top: 1px solid var(--line); }
summary { padding: 16px 0; cursor: pointer; font-size: 12px; font-weight: 750; }
summary span { float: right; color: var(--muted); font-weight: 400; }
textarea { resize: vertical; line-height: 1.5; }
.dialog-actions { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 20px; }

.back-button { padding: 0; border: 0; color: var(--muted); background: transparent; font-size: 12px; }
.case-header { display: grid; grid-template-columns: 1fr auto; gap: 30px; margin: 28px 0 40px; padding-bottom: 32px; border-bottom: 1px solid var(--line); }
.case-header h3 { max-width: 760px; margin: 0; font-size: clamp(38px, 5vw, 65px); line-height: .98; letter-spacing: -.04em; }
.case-summary { max-width: 920px; color: #35453e; font-size: 16px; line-height: 1.7; }
.section-title { margin: 47px 0 16px; display: flex; align-items: baseline; gap: 13px; font-size: 27px; }
.section-title span { color: var(--gold); font-family: Inter, sans-serif; font-size: 10px; letter-spacing: .12em; }
.analysis-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.analysis-card { padding: 23px; background: var(--paper); border: 1px solid var(--line); }
.analysis-card h4 { margin-bottom: 10px; font-family: Georgia, serif; font-size: 20px; }
.analysis-card p, .analysis-card li { color: #4d5953; font-size: 13px; line-height: 1.6; }
.analysis-card ul { padding-left: 17px; }
.severity { display: inline-block; margin-bottom: 10px; color: var(--rust); font-size: 9px; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
.source-list { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 14px; }
.source-chip { padding: 5px 7px; color: var(--forest-2); background: rgba(36,88,70,.07); border-radius: 2px; font-size: 9px; }
.oral-panel { margin-top: 48px; padding: clamp(25px, 5vw, 52px); color: white; background: var(--forest); position: relative; overflow: hidden; }
.oral-panel::after { content: "?"; position: absolute; right: 20px; top: -75px; color: rgba(255,255,255,.035); font-family: Georgia, serif; font-size: 270px; }
.oral-count { color: var(--gold); font-size: 10px; letter-spacing: .13em; text-transform: uppercase; }
.oral-panel h3 { max-width: 850px; margin: 18px 0; font-size: clamp(27px, 4vw, 43px); line-height: 1.15; position: relative; z-index: 1; }
.question-context { color: rgba(255,255,255,.55); font-size: 12px; }
.oral-panel textarea { min-height: 145px; margin: 20px 0 12px; color: white; background: rgba(255,255,255,.07); border-color: rgba(255,255,255,.2); position: relative; z-index: 1; }
.oral-panel .primary { color: var(--forest); background: var(--gold); }
.turn-card { margin-top: 12px; padding: 22px; background: rgba(255,255,255,.6); border-left: 3px solid var(--gold); }
.turn-card blockquote { margin: 10px 0; color: var(--muted); font-size: 13px; }
.scores { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; margin-top: 15px; }
.score { padding: 10px 5px; text-align: center; background: rgba(23,61,49,.06); font-size: 9px; text-transform: uppercase; }
.score strong { display: block; color: var(--forest); font-family: Georgia, serif; font-size: 22px; }
.processing { padding: 75px 20px; text-align: center; }
.loader { width: 47px; height: 47px; margin: 0 auto 25px; border: 1px solid rgba(23,61,49,.15); border-top-color: var(--gold); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.wiki-card { padding: clamp(25px, 5vw, 50px); background: var(--paper); border: 1px solid var(--line); }
.wiki-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 25px 0; }
.wiki-stat { padding: 20px; border: 1px solid var(--line); }
.wiki-stat strong { display: block; font-family: Georgia, serif; font-size: 34px; }
.toast { position: fixed; right: 25px; bottom: 25px; max-width: 360px; padding: 13px 18px; color: white; background: var(--ink); opacity: 0; transform: translateY(10px); transition: .25s; z-index: 30; pointer-events: none; }
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 800px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-copy { min-height: auto; padding: 60px 28px; }
  .login-copy h1 { font-size: 58px; }
  .principles { display: none; }
  .login-panel { min-height: 45vh; padding: 45px 28px; }
  .app-shell { display: block; }
  .sidebar { position: static; width: auto; height: 74px; padding: 15px 20px; flex-direction: row; align-items: center; }
  .sidebar nav { margin: 0 0 0 auto; display: flex; }
  .sidebar-foot, .nav-item span, .nav-item:nth-child(2) { display: none; }
  .workspace { width: 100%; }
  .topbar { min-height: 90px; padding: 18px 20px; }
  .page { padding: 34px 20px 70px; }
  .intro-grid, .analysis-grid, .upload-grid { grid-template-columns: 1fr; gap: 18px; }
  .intro-grid { align-items: start; }
  .case-header { grid-template-columns: 1fr; }
  .scores { grid-template-columns: repeat(2, 1fr); }
  .wiki-stats { grid-template-columns: 1fr; }
}

/* Chat principal */
.chat-app {
  height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  overflow: hidden;
  background: var(--paper);
}
.chat-sidebar {
  min-height: 0;
  padding: 27px 18px 20px;
  color: white;
  background: var(--forest);
  display: flex;
  flex-direction: column;
}
.new-chat-button {
  width: 100%;
  margin: 42px 0 28px;
  padding: 12px 14px;
  color: white;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 3px;
  text-align: left;
  font-size: 12px;
  font-weight: 750;
}
.new-chat-button:hover { background: rgba(255,255,255,.12); }
.sidebar-label {
  margin: 0 8px 10px;
  color: rgba(255,255,255,.35);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .13em;
  text-transform: uppercase;
}
.chat-list {
  min-height: 0;
  overflow-y: auto;
  display: grid;
  align-content: start;
  gap: 3px;
}
.chat-list-item {
  width: 100%;
  padding: 10px 11px;
  overflow: hidden;
  color: rgba(255,255,255,.62);
  background: transparent;
  border: 0;
  border-radius: 3px;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
}
.chat-list-item:hover, .chat-list-item.active {
  color: white;
  background: rgba(255,255,255,.08);
}
.chat-list-empty {
  padding: 9px;
  color: rgba(255,255,255,.32);
  font-size: 10px;
  line-height: 1.5;
}
.chat-workspace {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}
.chat-topbar {
  min-height: 92px;
  padding: 19px clamp(24px, 5vw, 70px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.chat-topbar h2 {
  max-width: 680px;
  margin: 0;
  overflow: hidden;
  font-size: 26px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.engine-badge {
  padding: 6px 9px;
  color: var(--forest-2);
  border: 1px solid rgba(36,88,70,.22);
  border-radius: 20px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.prompt-button {
  padding: 7px 10px;
  color: var(--forest-2);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 3px;
  font-size: 10px;
  font-weight: 750;
}
.prompt-button:hover {
  border-color: var(--gold);
  background: rgba(196,155,85,.06);
}
.prompt-dialog {
  width: min(760px, calc(100vw - 30px));
}
.prompt-dialog form {
  padding: clamp(24px, 4vw, 44px);
}
.prompt-dialog .dialog-head h2 {
  margin-bottom: 0;
}
.prompt-help {
  margin: 20px 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}
.prompt-dialog textarea {
  min-height: 330px;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 12px;
}
.messages {
  min-height: 0;
  overflow-y: auto;
  padding: 35px clamp(22px, 7vw, 110px) 50px;
  scroll-behavior: smooth;
}
.chat-welcome {
  max-width: 750px;
  margin: 8vh auto 0;
  text-align: center;
}
.chat-welcome .seal {
  width: 54px;
  height: 54px;
  margin: 0 auto 24px;
  display: grid;
  place-items: center;
  color: var(--gold);
  border: 1px solid var(--gold);
  border-radius: 50%;
  font-family: Georgia, serif;
}
.chat-welcome h1 {
  margin-bottom: 14px;
  font-size: clamp(38px, 5vw, 62px);
  letter-spacing: -.04em;
}
.chat-welcome > p {
  max-width: 610px;
  margin: 0 auto;
  color: var(--muted);
  line-height: 1.65;
}
.starter-grid {
  margin-top: 36px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
}
.starter {
  min-height: 92px;
  padding: 15px;
  color: var(--ink);
  background: rgba(255,255,255,.5);
  border: 1px solid var(--line);
  border-radius: 3px;
  font-family: Georgia, serif;
  line-height: 1.35;
  text-align: left;
}
.starter:hover {
  border-color: var(--gold);
  background: white;
  transform: translateY(-1px);
}
.message-row {
  width: min(900px, 100%);
  margin: 0 auto 30px;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 15px;
}
.message-avatar {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: white;
  background: var(--forest);
  border-radius: 50%;
  font-family: Georgia, serif;
  font-size: 11px;
}
.message-row.user .message-avatar {
  color: var(--forest);
  background: rgba(23,61,49,.1);
}
.message-content { min-width: 0; padding-top: 2px; }
.message-role {
  margin-bottom: 8px;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.message-text {
  color: #273a32;
  line-height: 1.72;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.message-row.user .message-text { color: var(--muted); }
.markdown > :first-child { margin-top: 0; }
.markdown > :last-child { margin-bottom: 0; }
.markdown p { margin: 0 0 13px; }
.markdown h3, .markdown h4, .markdown h5, .markdown h6 {
  margin: 24px 0 10px;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.25;
}
.markdown h3 { font-size: 25px; }
.markdown h4 { font-size: 21px; }
.markdown h5, .markdown h6 { font-size: 17px; }
.markdown ul, .markdown ol {
  margin: 8px 0 17px;
  padding-left: 23px;
}
.markdown li { margin: 5px 0; padding-left: 3px; }
.markdown strong { color: var(--ink); }
.markdown em { color: inherit; }
.markdown a { color: var(--forest-2); text-decoration-color: var(--gold); }
.markdown blockquote {
  margin: 16px 0;
  padding: 10px 15px;
  color: var(--muted);
  border-left: 3px solid var(--gold);
  background: rgba(196,155,85,.07);
}
.markdown code {
  padding: 2px 5px;
  background: rgba(19,35,29,.07);
  border-radius: 3px;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: .9em;
}
.markdown pre {
  margin: 16px 0;
  padding: 15px;
  overflow-x: auto;
  color: #e9efe9;
  background: #12231d;
  border-radius: 4px;
}
.markdown pre code { padding: 0; color: inherit; background: transparent; }
.message-sources, .message-attachments, .selected-files {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.attachment-chip {
  max-width: 280px;
  padding: 6px 8px;
  overflow: hidden;
  color: #795a25;
  background: rgba(196,155,85,.12);
  border-radius: 3px;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.typing {
  padding: 8px 0;
  color: var(--muted);
  font-size: 12px;
}
.typing::after {
  content: "…";
  display: inline-block;
  width: 20px;
  animation: pulse 1s infinite alternate;
}
@keyframes pulse { to { opacity: .2; } }
.chat-error {
  width: min(900px, 100%);
  margin: 0 auto 20px;
  padding: 12px 15px;
  color: var(--rust);
  background: rgba(166,78,53,.07);
  border-left: 2px solid var(--rust);
  font-size: 12px;
}
.composer-wrap {
  padding: 12px clamp(20px, 7vw, 100px) 20px;
  background: linear-gradient(0deg, var(--paper) 72%, rgba(251,248,240,0));
}
.composer {
  width: min(920px, 100%);
  margin: 0 auto;
}
.composer-row {
  min-height: 58px;
  padding: 8px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 5px;
  box-shadow: 0 10px 35px rgba(22,43,34,.09);
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 38px;
  align-items: end;
  gap: 4px;
}
.composer-row:focus-within { border-color: rgba(196,155,85,.75); }
.composer textarea {
  min-height: 40px;
  max-height: 180px;
  padding: 10px 8px 7px;
  background: transparent;
  border: 0;
  box-shadow: none;
  resize: none;
  line-height: 1.45;
}
.attach-button, .send-button {
  width: 36px;
  height: 36px;
  margin: 0;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
}
.attach-button {
  color: var(--muted);
  background: rgba(19,35,29,.06);
  cursor: pointer;
  font-size: 20px;
  font-weight: 400;
}
.send-button {
  color: white;
  background: var(--forest);
  font-size: 20px;
}
.send-button:disabled { opacity: .45; cursor: wait; }
.composer-note {
  margin: 7px 0 0;
  color: var(--muted);
  text-align: center;
  font-size: 9px;
}
.selected-files:empty { display: none; }
.selected-files { margin: 0 0 7px; }

@media (max-width: 720px) {
  .chat-app { grid-template-columns: 1fr; grid-template-rows: 64px minmax(0, 1fr); }
  .chat-sidebar {
    min-height: 64px;
    padding: 12px 16px;
    flex-direction: row;
    align-items: center;
  }
  .chat-sidebar .brand-mark { width: 36px; height: 36px; }
  .chat-sidebar .brand span:last-child, .chat-sidebar .sidebar-label,
  .chat-sidebar .chat-list, .chat-sidebar .sidebar-foot { display: none; }
  .new-chat-button { width: auto; margin: 0 0 0 auto; }
  .chat-topbar { min-height: 76px; padding: 14px 17px; }
  .chat-topbar h2 { font-size: 21px; }
  .engine-badge { display: none; }
  .prompt-button { font-size: 0; }
  .prompt-button::after { content: "Instrucciones"; font-size: 10px; }
  .messages { padding: 25px 16px 38px; }
  .starter-grid { grid-template-columns: 1fr; }
  .starter { min-height: auto; }
  .composer-wrap { padding: 9px 12px 14px; }
}

button.source-chip {
  border: 1px solid rgba(36,88,70,.18);
  font: inherit;
  font-size: 9px;
  cursor: pointer;
  transition: background .15s ease;
}
button.source-chip:hover {
  background: rgba(36,88,70,.16);
}
.wiki-link {
  color: var(--forest-2);
  background: rgba(36,88,70,.07);
  padding: 0 3px;
  border-radius: 2px;
  text-decoration: none;
  border-bottom: 1px solid rgba(36,88,70,.35);
  word-break: break-all;
}
.wiki-link:hover {
  background: rgba(36,88,70,.16);
}
.wiki-dialog {
  width: min(860px, calc(100vw - 30px));
  max-height: 86vh;
}
.wiki-dialog-body {
  padding: clamp(25px, 5vw, 52px);
  overflow-y: auto;
  max-height: 86vh;
}
.wiki-dialog .dialog-head h2 {
  font-size: 28px;
  margin-top: 4px;
}
.wiki-page-content {
  margin-top: 20px;
  font-size: 14px;
  line-height: 1.65;
}
.wiki-page-backlinks {
  margin-top: 28px;
}
