:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #090909;
  color: #f5f1e8;
  --muted: #aaa39a;
  --line: #373737;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 20% 0%, #221d17 0%, #0b0b0b 34%, #070707 100%); }
button, textarea, select { font: inherit; }
.shell { width: min(980px, calc(100% - 32px)); margin: 0 auto; padding: 42px 0 28px; }
.brand { display: flex; gap: 16px; align-items: center; margin-bottom: 24px; }
.mark { width: 52px; height: 52px; display: grid; place-items: center; border: 1px solid #9e875c; border-radius: 16px; font-family: Georgia, serif; font-size: 30px; color: #d8bd82; }
h1 { margin: 0; font-family: Georgia, serif; letter-spacing: .18em; font-weight: 500; font-size: 28px; }
.brand p { margin: 5px 0 0; color: #aaa39a; font-size: 14px; }
.notice { display: flex; gap: 10px; flex-wrap: wrap; border: 1px solid #3d3528; background: rgba(156,127,75,.08); border-radius: 14px; padding: 14px 16px; color: #d8c9ad; font-size: 13px; }
.notice span { color: #aaa39a; }
.chat { min-height: 52vh; padding: 28px 2px 18px; display: flex; flex-direction: column; gap: 18px; }
.bubble { max-width: 78%; padding: 16px 18px; border-radius: 18px; line-height: 1.55; white-space: pre-wrap; }
.bubble p { margin: 0 0 8px; }
.bubble p:last-child { margin-bottom: 0; }
.bubble.assistant { align-self: flex-start; display: flex; gap: 12px; background: #121212; border: 1px solid #292929; }
.bubble.user { align-self: flex-end; background: #e3d0a7; color: #19150f; }
.avatar { flex: 0 0 30px; width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid #9e875c; border-radius: 9px; color: #d8bd82; font-family: Georgia, serif; }
.composer { position: sticky; bottom: 0; background: linear-gradient(180deg, rgba(9,9,9,0), #090909 25%); padding-top: 28px; }
.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.tool { appearance: none; border: 1px solid #373737; background: #121212; color: #d0cbc2; border-radius: 999px; padding: 8px 12px; cursor: pointer; font-size: 13px; }
.tool:disabled { opacity: .5; cursor: not-allowed; }
.status { color: #8d887f; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entry { display: grid; grid-template-columns: 1fr auto; gap: 10px; border: 1px solid #383838; background: #111; border-radius: 18px; padding: 10px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
textarea { resize: none; border: 0; outline: 0; background: transparent; color: #f5f1e8; padding: 9px 10px; min-height: 72px; }
textarea::placeholder { color: #6e6a64; }
.send { border: 1px solid #ad915c; background: #d8bd82; color: #17130d; padding: 0 20px; border-radius: 13px; font-weight: 700; cursor: pointer; }
.send:disabled { opacity: .55; cursor: not-allowed; }
.fineprint { color: #6f6b65; font-size: 11px; text-align: center; }
@media (max-width: 640px) {
  .shell { width: min(100% - 20px, 980px); padding-top: 22px; }
  .bubble { max-width: 92%; }
  .entry { grid-template-columns: 1fr; }
  .send { min-height: 44px; }
}
.bubble-body { min-width: 0; }
.bubble-text { white-space: pre-wrap; }
.sources { margin-top: 14px; padding-top: 12px; border-top: 1px solid #2d2d2d; display: grid; gap: 7px; }
.sources strong { font-size: 12px; color: #a9a39a; text-transform: uppercase; letter-spacing: .08em; }
.sources a { color: #d8bd82; text-decoration: none; font-size: 13px; }
.sources a:hover { text-decoration: underline; }
.tool.danger { border-color: #553a3a; color: #c7a8a8; }
.tool.danger:hover { border-color: #7a4b4b; }
.security-note { margin-top: 12px; padding: 10px 12px; border-radius: 10px; border: 1px solid #57482d; background: rgba(145,112,50,.08); color: #c7b890; font-size: 12px; line-height: 1.45; }

.legal-banner {
  margin-top: 10px;
  display: grid;
  gap: 4px;
  border: 1px solid #5a4527;
  background: rgba(151, 101, 35, .10);
  border-radius: 14px;
  padding: 13px 16px;
  color: #e3c990;
  font-size: 12px;
  line-height: 1.5;
}
.legal-banner span { color: #b9aa91; }
.legal-disclaimer {
  margin-top: 14px;
  padding: 11px 12px;
  display: grid;
  gap: 4px;
  border: 1px solid #6b4b24;
  border-radius: 10px;
  background: rgba(168, 106, 31, .10);
  color: #d9bf8d;
  font-size: 12px;
  line-height: 1.45;
}
.legal-disclaimer strong { color: #efcf91; }
.camera-dialog {
  width: min(760px, calc(100% - 24px));
  border: 1px solid #39332b;
  border-radius: 20px;
  padding: 0;
  background: #0e0e0e;
  color: #f5f1e8;
  box-shadow: 0 28px 100px rgba(0,0,0,.72);
}
.camera-dialog::backdrop { background: rgba(0,0,0,.78); backdrop-filter: blur(5px); }
.camera-panel { padding: 18px; }
.camera-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 14px; }
.camera-head strong { font-family: Georgia, serif; font-size: 20px; font-weight: 500; }
.camera-head p { margin: 5px 0 0; color: #8f8980; font-size: 12px; }
.icon-button { border: 0; background: transparent; color: #bcb5aa; font-size: 28px; line-height: 1; cursor: pointer; padding: 0 4px; }
.camera-preview { overflow: hidden; border-radius: 14px; background: #030303; min-height: 280px; display: grid; place-items: center; }
.camera-preview video { display: block; width: 100%; max-height: 62vh; object-fit: contain; background: #000; }
.camera-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 14px; }
.camera-capture { min-height: 40px; padding: 0 18px; }
.camera-status { min-height: 18px; margin: 10px 2px 0; color: #918a80; font-size: 12px; }
@media (max-width: 640px) {
  .toolbar { flex-wrap: wrap; }
  .status { width: 100%; }
  .camera-panel { padding: 12px; }
  .camera-preview { min-height: 220px; }
  .camera-actions { justify-content: stretch; }
  .camera-actions .tool, .camera-actions .send { flex: 1; }
}
.listen-button {
  margin-top: 12px;
  border: 1px solid #3d3528;
  background: transparent;
  color: #cdbb96;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
}
.listen-button:hover { border-color: #796748; }
.listen-button:disabled { opacity: .55; cursor: not-allowed; }

.consent-dialog { width:min(680px,calc(100% - 24px)); border:1px solid #5a4527; border-radius:20px; padding:0; background:#0e0e0e; color:#f5f1e8; box-shadow:0 28px 100px rgba(0,0,0,.78); }
.consent-dialog::backdrop { background:rgba(0,0,0,.84); backdrop-filter:blur(6px); }
.consent-panel { padding:24px; line-height:1.55; }
.consent-panel h2 { margin:0 0 14px; font-family:Georgia,serif; font-weight:500; color:#e3c990; }
.consent-panel p { color:#b9aa91; font-size:13px; }
.consent-check { display:flex; gap:10px; align-items:flex-start; margin:18px 0; padding:12px; border:1px solid #3d3528; border-radius:12px; color:#d8c9ad; font-size:13px; }
.consent-check input { margin-top:3px; }
.consent-accept { width:100%; min-height:46px; }

.session-documents { display:flex; flex-wrap:wrap; gap:7px; min-height:0; margin:0 0 8px; }
.document-chip { display:flex; align-items:center; gap:8px; max-width:100%; border:1px solid #303030; background:#101010; border-radius:999px; padding:5px 6px 5px 10px; color:#aaa39a; font-size:11px; }
.document-chip span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.document-remove { border:1px solid #523838; background:#171111; color:#c4a3a3; border-radius:999px; padding:4px 7px; font-size:10px; cursor:pointer; }
.document-remove:disabled { opacity:.5; cursor:not-allowed; }

.language-tool {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  font-size: .82rem;
  color: var(--muted);
}
.language-tool select {
  max-width: 10.5rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: inherit;
  padding: .45rem .65rem;
}
.language-tool select:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

.training-consent-preview {
  margin: 18px 0;
  padding: 14px;
  border: 1px solid #3d3528;
  border-radius: 14px;
  background: rgba(216, 189, 130, .045);
}
.training-consent-preview > strong { color: #e3c990; font-size: 13px; }
.training-consent-preview p { margin: 9px 0; }
.consent-check-disabled { opacity: .72; cursor: not-allowed; }
.consent-check-disabled input { cursor: not-allowed; }
.training-warning { padding: 10px 11px; border-left: 3px solid #806836; background: rgba(128, 104, 54, .08); }

/* v0.9 optional ML contribution: secondary, explicit and off by default. */
.training-contribution[hidden] { display: none !important; }
.training-contribution { margin:8px 0 12px; padding:13px 14px; border:1px solid #3d3528; border-radius:14px; background:rgba(216,189,130,.04); color:#b9aa91; font-size:12px; line-height:1.5; }
.training-title { color:#e3c990; font-weight:650; margin-bottom:8px; }
.training-consent-check, .training-document-check { display:flex; gap:10px; align-items:flex-start; padding:9px 0; }
.training-consent-check + .training-document-check { border-top:1px solid #28241e; }
.training-consent-check input, .training-document-check input { margin-top:3px; flex:0 0 auto; }
.training-consent-check strong, .training-document-check strong { color:#d8c9ad; }
.training-consent-check:has(input:disabled), .training-document-check:has(input:disabled) { opacity:.62; }
.training-status { margin:7px 0 0; color:#8f8980; font-size:11px; }
