/* Chat interface — RTL Hebrew, self-hosted Heebo, CSP-safe (no inline styles).
   Mirrors the dashboard's self-host + dark palette so the strict CSP
   (style-src 'self'; font-src 'self') holds with zero external requests. */

@font-face {
  font-family: 'Heebo';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/heebo-400-hebrew.woff2') format('woff2');
  unicode-range: U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F;
}
@font-face {
  font-family: 'Heebo';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/heebo-400-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+2122;
}
@font-face {
  font-family: 'Heebo';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('fonts/heebo-700-hebrew.woff2') format('woff2');
  unicode-range: U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F;
}
@font-face {
  font-family: 'Heebo';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('fonts/heebo-700-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+2122;
}

:root {
  --bg: #020617;
  --panel: #0f172a;
  --line: #1e293b;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --me: #1d4ed8;
  --bot: #1e293b;
  --accent: #38bdf8;
}

* { box-sizing: border-box; }

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

body {
  display: flex;
  flex-direction: column;
  max-width: 760px;
  margin: 0 auto;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}

.topbar {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  position: sticky;
  top: 0;
  flex-wrap: wrap;
}
.brand { font-weight: 700; font-size: 1.1rem; color: var(--accent); }
.subtitle { color: var(--muted); font-size: 0.85rem; }
.status { margin-inline-start: auto; color: var(--muted); font-size: 0.8rem; min-height: 1em; }

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.msg { display: flex; }
.msg-me { justify-content: flex-start; }
.msg-bot { justify-content: flex-end; }

.bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 16px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.msg-me .bubble { background: var(--me); color: #fff; border-bottom-right-radius: 4px; }
.msg-bot .bubble { background: var(--bot); color: var(--text); border-bottom-left-radius: 4px; }
.bubble.err { background: #7f1d1d; color: #fee2e2; }
.bubble.typing { color: var(--muted); font-style: italic; }

.composer {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  background: var(--panel);
}
.input {
  flex: 1;
  resize: none;
  max-height: 160px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  font: inherit;
}
.input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.send {
  padding: 0 18px;
  border: 0;
  border-radius: 12px;
  background: var(--me);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.send:disabled { opacity: 0.5; cursor: default; }

.attach {
  flex: 0 0 auto;
  width: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  font-size: 1.2rem;
  cursor: pointer;
}
.attach:disabled { opacity: 0.5; cursor: default; }
.attach.has-files { background: var(--me); border-color: var(--me); }
