/* Design tokens from the 3affya platform. Keep them in step with its app/globals.css. */
@font-face {
  font-family: "Readex Pro";
  src: url("/static/fonts/ReadexPro-Variable.ttf") format("truetype-variations");
  font-weight: 160 700;
  font-display: swap;
}
:root {
  --sea-900: #062f52; --sea-800: #08467a; --sea-700: #0b5a9c; --sea-100: #dcebf7;
  --lagoon-600: #0194be; --lagoon-500: #02b3ca; --lagoon-100: #ddf6fa;
  --gold-100: #f8ebc4; --gold-700: #82590a;
  --sand-50: #f8f6f1; --sand-100: #efebe2; --sand-200: #e2dcce; --sand-300: #dbd3bf;
  --ink-900: #14202e; --ink-700: #34404e; --ink-500: #5e6a77;
  --danger: #a83128; --danger-bg: #fbe9e7;
  --radius-card: 22px; --radius-field: 12px; --radius-tag: 999px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--sand-50); color: var(--ink-900);
  font-family: "Readex Pro", "Segoe UI", Tahoma, Arial, sans-serif; font-size: 16px; line-height: 1.55;
  display: flex; flex-direction: column;
}
html[lang="ar"] body { font-size: 17px; line-height: 1.7; }
:focus-visible { outline: 3px solid var(--lagoon-500); outline-offset: 2px; }
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }
[hidden] { display: none !important; }

.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 10px 16px; background: #fff; border-bottom: 1px solid var(--sand-200);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { display: block; height: 30px; width: auto; }
.product { font-weight: 600; color: var(--sea-700); border-inline-start: 1px solid var(--sand-300); padding-inline-start: 10px; }
.top-actions { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.top-actions form { margin: 0; }
.link {
  background: none; border: 0; color: var(--sea-700); font: inherit; font-size: 15px; font-weight: 600;
  padding: 8px 10px; border-radius: var(--radius-field); cursor: pointer; min-height: 40px;
}
.link:hover { background: var(--sand-100); }

.btn {
  min-height: 48px; padding: 12px 20px; border: 0; border-radius: var(--radius-field);
  background: var(--sea-700); color: #fff; font: inherit; font-size: 15px; font-weight: 600; cursor: pointer;
}
.btn:hover { background: var(--sea-800); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
input, textarea {
  width: 100%; min-height: 48px; padding: 12px 16px; border: 1px solid var(--sand-300); border-radius: var(--radius-field);
  background: #fff; color: var(--ink-900); font: inherit;
}
input:focus, textarea:focus { border-color: var(--lagoon-600); }
.muted { color: var(--ink-500); }
.error { color: var(--danger); font-weight: 600; }

.narrow { width: 100%; max-width: 420px; margin: 8vh auto; padding: 0 16px; }
.card { background: #fff; border: 1px solid var(--sand-200); border-radius: var(--radius-card); padding: 24px; display: grid; gap: 14px; }
.card h1 { margin: 0; font-size: 24px; color: var(--sea-900); }
.card p { margin: 0; }
.card label { display: grid; gap: 4px; font-size: 15px; font-weight: 600; color: var(--ink-700); }

.chat { flex: 1; min-height: 0; width: 100%; max-width: 820px; margin: 0 auto; padding: 0 16px 10px; display: flex; flex-direction: column; }
.messages { flex: 1; min-height: 0; overflow-y: auto; padding: 18px 0 8px; display: flex; flex-direction: column; gap: 12px; }
.welcome { margin: auto 0; text-align: center; padding: 24px 0; }
.welcome h1 { margin: 0 0 6px; font-size: 26px; color: var(--sea-900); }
.welcome p { margin: 0 0 18px; }
.turn { display: flex; }
.turn.user { justify-content: flex-end; }
.bubble { max-width: min(680px, 92%); padding: 12px 16px; border-radius: 18px; background: #fff; border: 1px solid var(--sand-200); overflow-wrap: anywhere; }
.turn.user .bubble { background: var(--sea-700); border-color: var(--sea-700); color: #fff; }
.bubble p { margin: 0 0 10px; }
.bubble p:last-child, .bubble ul:last-child { margin-bottom: 0; }
.bubble ul { margin: 0 0 10px; padding-inline-start: 22px; }
.bubble li { margin-bottom: 3px; }
.urgent { background: var(--danger-bg); color: var(--danger); font-weight: 600; padding: 10px 12px; border-radius: var(--radius-field); }
.sources { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--sand-200); display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 14px; }
.sources-label { color: var(--ink-500); font-weight: 600; }
.sources a { color: var(--sea-700); }
.sources a.minor { color: var(--ink-500); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chips.follow { justify-content: flex-start; }
.chip {
  border: 1px solid var(--sea-700); background: #fff; color: var(--sea-700); border-radius: var(--radius-tag);
  padding: 8px 14px; font: inherit; font-size: 14.5px; cursor: pointer; text-align: start;
}
.chip:hover { background: var(--sea-100); }
.note { margin: 0; font-size: 15px; color: var(--ink-500); }
.note.error { color: var(--danger); font-weight: 600; }
.note.thinking::after { content: ""; display: inline-block; width: 1.2em; text-align: start; animation: dots 1.2s steps(4, end) infinite; }
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }
@media (prefers-reduced-motion: reduce) { .note.thinking::after { animation: none; content: "…"; } }
.ask { display: flex; gap: 8px; align-items: flex-end; padding-top: 8px; }
.ask textarea { resize: none; max-height: 160px; }
.disclaimer { margin: 8px 0 0; font-size: 12.5px; color: var(--ink-500); text-align: center; }
