/* Matrix Health — tema terang merah/putih. Font sistem (tanpa unduhan dari luar). */
:root {
  --red: #b3262e; --red-dark: #8e1d24; --red-ink: #6e1419; --red-tint: #fbe9ea; --red-wash: #fff8f8;
  --ink: #1f1a1a; --muted: #5f5757; --line: #e9dedc; --field: #d6c9c7; --ground: #faf6f5; --card: #fff;
  --ok: #2f7d4f; --wait: #9a8f8d; --amber-bg: #fffbee; --amber-line: #e0b84a; --amber-ink: #6b4a00;
  --radius: 12px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--ground); color: var(--ink);
  font: 14px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
h1 { font-size: 24px; margin: 0; line-height: 1.25; }
h2 { font-size: 18px; margin: 0 0 8px; }
button, input, textarea, select { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.pad { padding: 24px; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }

/* tata letak */
.app { display: flex; flex-wrap: wrap; min-height: 100vh; }
.side { flex: 0 0 232px; background: var(--card); border-right: 1px solid var(--line); padding: 24px 16px;
  display: flex; flex-direction: column; gap: 4px; }
.brand { font-size: 18px; font-weight: 700; color: var(--red); padding: 4px 12px 20px; }
.nav { display: block; width: 100%; text-align: left; background: none; border: 0; border-radius: 8px;
  padding: 10px 12px; font-weight: 500; color: #4a4242; cursor: pointer; min-height: 44px; }
.nav:hover { background: var(--ground); }
.nav[aria-current="page"] { background: var(--red-tint); color: var(--red-dark); font-weight: 700; }
.who { margin-top: auto; padding: 12px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.who b { color: var(--ink); }
.main { flex: 999 1 560px; min-width: 0; padding: 24px 32px 48px; display: flex; flex-direction: column; gap: 20px; }
.head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.row { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.col { flex: 1 1 420px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.col.narrow { flex-basis: 320px; }
@media (max-width: 720px) { .side { flex-basis: 100%; border-right: 0; border-bottom: 1px solid var(--line); }
  .main { padding: 16px; } }

/* komponen */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.card.alert { border: 2px solid var(--red); background: var(--red-wash); }
.card.accent { border-color: var(--red); }
.card.amber { border-color: var(--amber-line); background: var(--amber-bg); }
.label { font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; margin: 0 0 8px; }
.label.red { color: var(--red-dark); }
.field { display: flex; flex-direction: column; gap: 6px; }
.row > .field { flex: 1 1 200px; } /* lebar hanya di baris; di kolom flex-basis akan jadi TINGGI */
.field label { font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .03em; text-transform: uppercase; }
input[type=text], input[type=password], input[type=number], textarea, select {
  border: 1px solid var(--field); border-radius: 8px; padding: 10px 12px; background: #fff; width: 100%; }
input:focus, textarea:focus, select:focus, button:focus-visible { outline: 2px solid var(--red); outline-offset: 1px; }
textarea { min-height: 120px; resize: vertical; }
.box { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: var(--ground); }
.btns { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.btn { background: var(--red); color: #fff; border: 1px solid var(--red); border-radius: 8px; padding: 11px 20px;
  font-weight: 700; cursor: pointer; min-height: 44px; }
.btn:hover { background: var(--red-dark); }
.btn.ghost { background: #fff; color: var(--red-dark); font-weight: 600; }
.btn.ghost:hover { background: var(--red-tint); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.pill { display: inline-block; border-radius: 999px; padding: 4px 10px; font-size: 12px; font-weight: 700; }
.pill.test { background: #fff1c9; color: var(--amber-ink); }
.pill.red { background: var(--red); color: #fff; }
.pill.grey { background: var(--line); color: #4a4242; }
.tok { background: var(--red-tint); color: var(--red-dark); border-radius: 4px; padding: 0 4px; font-weight: 700; }
.msg { border-radius: 8px; padding: 10px 12px; font-size: 13px; }
.msg.err { background: var(--red-tint); color: var(--red-ink); }
.msg.ok { background: #e7f4ec; color: #1d5a37; }
.msg.warn { background: var(--amber-bg); color: var(--amber-ink); border: 1px solid var(--amber-line); }
.agent { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-top: 1px solid #f0e6e4; }
.agent:first-of-type { border-top: 0; }
.dot { flex: 0 0 12px; height: 12px; border-radius: 50%; margin-top: 5px; background: var(--wait); }
.dot.work { background: var(--red); } .dot.done { background: var(--ok); }
.agent .st { font-size: 12px; font-weight: 700; margin-left: auto; white-space: nowrap; }
.hist { padding: 10px 0; border-top: 1px solid #f0e6e4; }
.hist:first-of-type { border-top: 0; }
.hist .whom { font-size: 12px; font-weight: 700; letter-spacing: .03em; }
.check { display: flex; gap: 8px; align-items: center; min-height: 32px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-top: 1px solid #f0e6e4; vertical-align: top; }
th { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; border-top: 0; }
.scroll { overflow-x: auto; }
.login { max-width: 420px; margin: 8vh auto; }
.qr { display: block; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px; margin: 10px 0; }

/* teks model (Markdown sederhana) */
.md { overflow-wrap: anywhere; }
.md p { margin: 0 0 8px; }
.md h3 { font-size: 16px; margin: 14px 0 6px; }
.md h4 { font-size: 14px; margin: 12px 0 4px; }
.md ul, .md ol { margin: 0 0 8px; padding-left: 22px; }
.md li { margin: 2px 0; }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 12px 0; }
.md > :last-child { margin-bottom: 0; }
.md table { margin: 4px 0 10px; font-size: 13px; }
.md th { background: var(--ground); }

/* chat */
.msgs { display: flex; flex-direction: column; gap: 12px; }
.bubble { max-width: 82%; border-radius: 12px; padding: 10px 14px; }
.bubble.me { align-self: flex-end; background: var(--red-tint); }
.bubble.ai { align-self: flex-start; background: #fff; border: 1px solid var(--line); }
.bubble .whom { font-size: 11px; font-weight: 700; letter-spacing: .04em; color: var(--muted); margin-bottom: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.chip { text-align: left; background: var(--ground); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px;
  cursor: pointer; min-height: 44px; max-width: 520px; }
.chip:hover { border-color: var(--red); }
.choices { display: flex; flex-wrap: wrap; gap: 12px; }
.choice { flex: 1 1 260px; display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 10px;
  padding: 12px; cursor: pointer; }
.choice span { display: flex; flex-direction: column; gap: 2px; }
.choice:has(input:checked) { border-color: var(--red); background: var(--red-wash); }
@media (max-width: 720px) { .bubble { max-width: 100%; } }
.tcard { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin: 4px 0 12px; background: var(--ground); }
.tcard .label { margin-top: 8px; }
.urg { display: inline-block; font-weight: 800; padding: 8px 12px; border-radius: 8px; margin: 2px 0 6px; letter-spacing: .02em; }
.urg-darurat { background: var(--red); color: #fff; }
.urg-segera { background: #f6dcb0; color: #5c3200; }
.urg-terjadwal { background: #fff1c9; color: var(--amber-ink); }
.urg-rumah { background: #e7f4ec; color: #1d5a37; }
.tlist { margin: 0 0 6px; padding-left: 20px; }
.tlist.warn li { color: var(--red-ink); }

/* kesimpulan & kemungkinan */
.big { font-size: 20px; font-weight: 700; line-height: 1.3; margin: 2px 0 14px; }
.big .muted { font-size: 15px; font-weight: 600; }
.dx { margin: 10px 0; }
.dx-row { display: flex; justify-content: space-between; gap: 12px; }
.bar { height: 10px; border-radius: 5px; background: #f0e6e4; overflow: hidden; margin-top: 5px; }
.bar i { display: block; height: 100%; background: var(--red); }
details > summary { cursor: pointer; font-weight: 700; min-height: 32px; display: list-item; }
details[open] > summary { margin-bottom: 10px; }
.radio { display: flex; gap: 10px; align-items: center; min-height: 36px; }
