/* ===== DFT Module 2 — shared tokens & components ===== */
:root {
  /* brand */
  --navy-900: #0e2346;      /* UI/primary */
  --navy-850: #0f2147;
  --navy-800: #1c2b4e;
  --navy-700: #1d4e91;
  --ink: #1f2a3c;
  --ink-2: #101828;
  --ink-3: #344054;
  --muted: #7a8597;
  --muted-2: #667085;
  --placeholder: #a3acb8;
  --orange: #f28a1e;
  --orange-text: #e8893a;
  --sky-50: #eef5fc;
  --sky-chat: #f7f9fc;
  --blue-chip-border: #9ed8fa;
  --blue-chip-text: #006aa8;
  --blue-link: #0089d6;
  --line: #dde3ea;
  --line-2: #d6dce3;
  --line-3: #e4e7ec;
  --white: #ffffff;
  --disabled-bg: #f2f2f3;
  --disabled-text: #9fa7b5;
  --border: #d3d4d6;

  --font-th: "Sarabun", "Noto Sans Thai", sans-serif;
  --font-ui: "Noto Sans Thai", "Sarabun", sans-serif;
  --font-serif: "Noto Serif", serif;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-th);
  color: var(--ink);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
button { font: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }
input { font: inherit; }

.icon { display: inline-block; flex-shrink: 0; }

/* ===== Floating AI chat (component "Dialog - แชตกับผู้ช่วย AI") ===== */
.chat-fab {
  position: fixed;
  right: 28px; bottom: 28px;
  width: 72px; height: 72px;
  border: 0; border-radius: 36px;
  background: linear-gradient(to bottom, #14c1ff, #0896ee);
  filter: drop-shadow(0 8px 10px rgba(0, 140, 230, .35));
  display: flex; align-items: center; justify-content: center;
  z-index: 50;
  transition: transform .15s ease;
}
.chat-fab:hover { transform: scale(1.05); }
.chat-fab img { width: 44px; height: 44px; }

.chat-dialog {
  position: fixed;
  right: 51px; bottom: 101px;
  width: 395px; height: 474px;
  display: flex; flex-direction: column;
  background: var(--white);
  border: 1px solid var(--line-3);
  border-radius: 18px;
  box-shadow: 0 18px 50px rgba(15, 33, 71, .25);
  overflow: hidden;
  font-family: var(--font-ui);
  z-index: 49;
  transform-origin: bottom right;
  transition: opacity .18s ease, transform .18s ease;
}
.chat-dialog[hidden] { display: flex; opacity: 0; transform: scale(.94) translateY(8px); pointer-events: none; }

.chat-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px;
  background: linear-gradient(to bottom, #00b9ff, #0096f0);
  color: var(--white);
}
.chat-head img.avatar { width: 44px; height: 44px; }
.chat-head .title { font-weight: 600; font-size: 14.5px; line-height: normal; }
.chat-head .sub { font-size: 12px; opacity: .9; margin-top: 4px; }
.chat-head .collapse {
  margin-left: auto; background: none; border: 0; padding: 4px; opacity: .9;
}
.chat-head .collapse img { width: 18px; height: 18px; }

.chat-body {
  flex: 1 1 0; min-height: 0; overflow-y: auto;
  display: flex; flex-direction: column; gap: 10px;
  padding: 14px 14px 10px;
  background: var(--sky-chat);
}
.chat-label { font-size: 11.5px; color: var(--muted-2); padding-left: 2px; }
.chat-time { align-self: center; font-size: 11px; color: #a6abb8; padding: 3px 0; }

.news-card {
  background: var(--white);
  border: 1px solid #cfe9fb;
  border-radius: 4px 14px 14px 14px;
  overflow: hidden;
  flex-shrink: 0;
}
.news-card .bar {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 12px; background: #e6f6ff;
  font-size: 12px;
}
.news-card .bar img { width: 14px; height: 14px; }
.news-card .bar strong { color: var(--blue-chip-text); font-weight: 600; }
.news-card .bar time { margin-left: auto; color: #4a6b85; }
.news-card .content { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; }
.news-card h4 { margin: 0; font-size: 14px; font-weight: 600; line-height: 20.3px; color: var(--ink-2); }
.news-card p { margin: 0 0 7px; font-size: 13px; line-height: 20.15px; color: var(--ink-3); }
.news-card a { font-size: 13px; font-weight: 500; color: var(--blue-link); }

.msg-bot {
  align-self: flex-start;
  max-width: 333px;
  background: var(--white);
  border: 1px solid var(--line-3);
  border-radius: 4px 14px 14px 14px;
  padding: 9px 12px;
  font-size: 13.5px; line-height: 20.93px; color: var(--ink-2);
  flex-shrink: 0;
}
.msg-user {
  align-self: flex-end;
  max-width: 300px;
  background: #0093ff; color: var(--white);
  border-radius: 14px 14px 3px 14px;
  padding: 9px 14px 10px;
  font-size: 13px; line-height: 20.15px;
  flex-shrink: 0;
}
.msg-user small { display: block; text-align: right; font-size: 10px; line-height: 15.5px; color: rgba(255,255,255,.75); margin-top: 3px; }

.chips { display: flex; flex-wrap: wrap; gap: 7px 6px; flex-shrink: 0; max-width: 320px; }
.chip {
  background: var(--white);
  border: 1px solid var(--blue-chip-border);
  border-radius: 999px;
  padding: 4px 11px;
  font-family: var(--font-ui); font-size: 12.5px; color: var(--blue-chip-text);
  white-space: nowrap;
}
.chip:hover { background: #e6f6ff; }

.typing { display: inline-flex; gap: 4px; padding: 4px 0; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: #9fa7b5; animation: blink 1s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }

.chat-foot {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  background: var(--white);
  border-top: 1px solid var(--line-3);
}
.chat-foot input {
  flex: 1 1 0; min-width: 0;
  border: 1px solid var(--line-3); border-radius: 999px;
  padding: 8px 14px;
  font-family: var(--font-ui); font-size: 13px; color: var(--ink-2);
  outline: none;
}
.chat-foot input::placeholder { color: #757575; }
.chat-foot input:focus { border-color: #9ed8fa; }
.chat-foot button {
  width: 36px; height: 36px; border: 0; border-radius: 18px;
  background: var(--navy-850);
  display: flex; align-items: center; justify-content: center;
}
.chat-foot button img { width: 16px; height: 16px; }
