/* Bouchiba AI Care: blue-and-white medical theme. Light only, by design. */
:root {
  --bg: #f4f7fc; --card: #ffffff; --ink: #0e1b33; --ink-2: #33415c; --muted: #66758f; --line: #e2e9f3; --line-2: #eef3f9;
  --brand: #1560d8; --brand-2: #0b4bb3; --brand-3: #083a8c; --brand-soft: #eaf2ff; --brand-softer: #f5f9ff; --sky: #3d8bfd;
  --red: #d42f3a; --red-soft: #fff0f1; --orange: #c46a0a; --orange-soft: #fff5e8; --green: #178a52; --green-soft: #e9f8f0;
  --c1: #e3eeff; --c2: #d9e8fe; --c3: #e6f4ff; --c4: #dde9fb; --c5: #e8efff; --c6: #d6e6fb;
  --nadir: #f3b6ba;
  --radius: 16px;
  --shadow-sm: 0 1px 2px rgba(14, 40, 90, .06);
  --shadow: 0 1px 2px rgba(14, 40, 90, .05), 0 6px 20px rgba(14, 40, 90, .06);
  --shadow-lg: 0 12px 40px rgba(11, 75, 179, .18);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans Arabic", "Geeza Pro", Tahoma, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font: 16px/1.55 var(--font); -webkit-text-size-adjust: 100%; -webkit-font-smoothing: antialiased; }
[dir=rtl] body { font-size: 17px; }
h1 { font-size: 1.45rem; line-height: 1.25; margin: .5rem 0 .6rem; letter-spacing: -.01em; }
h2 { font-size: .78rem; margin: 1.5rem 0 .55rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
[dir=rtl] h2 { font-size: .9rem; letter-spacing: 0; }
h3 { font-size: 1rem; margin: 1rem 0 .4rem; }
p { margin: .35rem 0; }
a { color: var(--brand); }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.err { color: var(--red); font-weight: 500; }
.ic { width: 1.25em; height: 1.25em; flex: 0 0 auto; vertical-align: -.25em; }
[dir=rtl] .ic-flip, [dir=rtl] .cta-go .ic, [dir=rtl] .btn.send .ic { transform: scaleX(-1); }

button, input, textarea, select { font: inherit; color: inherit; }
input, textarea, select { width: 100%; padding: .78rem .9rem; border: 1.5px solid var(--line); border-radius: 12px; background: var(--card); margin-top: .35rem; transition: border-color .15s, box-shadow .15s; }
input::placeholder, textarea::placeholder { color: #9aa7bd; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(21, 96, 216, .12); }
label { display: block; margin: .8rem 0; font-weight: 600; font-size: .94rem; color: var(--ink-2); }
:focus-visible { outline: 3px solid rgba(21, 96, 216, .45); outline-offset: 2px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 44px; padding: .65rem 1.1rem; border-radius: 12px; border: 1.5px solid var(--line); background: var(--card); cursor: pointer; text-decoration: none; font-weight: 600; color: var(--ink); transition: background .15s, border-color .15s, transform .1s, box-shadow .15s; }
.btn:hover { border-color: #c9d6ea; }
.btn:active { transform: scale(.98); }
.btn.primary { background: linear-gradient(180deg, #1f6ae6, var(--brand)); border-color: var(--brand); color: #fff; box-shadow: 0 4px 14px rgba(21, 96, 216, .28); }
.btn.primary:hover { background: var(--brand-2); }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; box-shadow: 0 4px 14px rgba(212, 47, 58, .25); }
.btn.big { min-height: 52px; padding: .85rem 1.2rem; font-size: 1.04rem; border-radius: 14px; }
.btn.wide { width: 100%; margin-top: .9rem; }
.btn:disabled { opacity: .5; box-shadow: none; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 12px; background: transparent; padding: 0; cursor: pointer; color: inherit; }
.icon-btn:hover { background: var(--brand-soft); }
.icon-btn .ic { width: 22px; height: 22px; }

/* login */
.login { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; gap: 1.1rem;
  background: radial-gradient(1200px 520px at 50% -140px, #cfe1ff 0%, rgba(207, 225, 255, 0) 70%), var(--bg); }
.login-top { width: 100%; max-width: 400px; display: flex; justify-content: flex-end; }
.login-brand { text-align: center; }
.login-brand .mark { filter: drop-shadow(0 10px 22px rgba(21, 96, 216, .3)); }
.brand-name { font-size: 1.7rem; font-weight: 800; letter-spacing: -.02em; margin-top: .6rem; color: var(--brand-3); }
.brand-name span, .title span { color: var(--brand); font-weight: 700; }
.brand-sub { color: var(--muted); font-size: .92rem; margin-top: .1rem; }
.login-card { width: 100%; max-width: 400px; background: var(--card); padding: 1.6rem 1.5rem 1.5rem; border-radius: 22px; box-shadow: var(--shadow); border: 1px solid var(--line); text-align: start; }
.login-card h1 { margin-top: 0; font-size: 1.3rem; }
.login-foot { display: flex; align-items: center; gap: .4rem; color: var(--muted); font-size: .84rem; margin: 0; }
.login-foot .ic { color: var(--brand); }
.logo { width: 56px; height: 56px; margin: 0 auto .6rem; border-radius: 16px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-size: 1.5rem; }
.langs { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--brand-soft); gap: 2px; }
.lang { border: 0; background: transparent; padding: .28rem .7rem; border-radius: 999px; cursor: pointer; font-weight: 700; font-size: .8rem; color: var(--brand-2); min-width: 2.2rem; }
.lang.on { background: var(--card); color: var(--brand); box-shadow: var(--shadow-sm); }

/* shell */
.top { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .6rem 16px; padding-top: max(.6rem, env(safe-area-inset-top));
  background: rgba(255, 255, 255, .9); backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px); border-bottom: 1px solid var(--line); color: var(--ink); }
.brand { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.brand .mark { flex: 0 0 auto; }
.top .title { font-weight: 800; font-size: 1.02rem; letter-spacing: -.01em; color: var(--brand-3); white-space: nowrap; }
.top .sub { font-size: .74rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand > div { min-width: 0; }
.top-r { display: flex; align-items: center; gap: .25rem; flex: 0 0 auto; }
.top-r .icon-btn { color: var(--muted); }
.sos { display: flex; align-items: center; gap: .7rem; margin: 0; padding: .55rem 16px; background: var(--red-soft); color: #a3212b; text-decoration: none; font-size: .8rem; line-height: 1.35; border-bottom: 1px solid #fbd9dc; }
.sos > span:last-child { display: flex; flex-direction: column; }
.sos strong { font-size: .92rem; color: var(--red); }
.sos-ic { flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%; background: var(--red); color: #fff; display: grid; place-items: center; box-shadow: 0 0 0 4px rgba(212, 47, 58, .14); }
.sos-ic .ic { width: 18px; height: 18px; }
main { max-width: 640px; margin: 0 auto; padding: 14px 16px calc(96px + env(safe-area-inset-bottom)); }
.tabs { position: fixed; bottom: 0; inset-inline: 0; z-index: 5; display: grid; grid-template-columns: repeat(5, 1fr); background: rgba(255, 255, 255, .94); backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px); border-top: 1px solid var(--line); padding: .3rem 4px env(safe-area-inset-bottom); }
.tabs button { border: 0; background: transparent; padding: .3rem 0 .45rem; display: flex; flex-direction: column; align-items: center; gap: .15rem; font-size: .7rem; font-weight: 600; color: var(--muted); cursor: pointer; }
.tab-ic { display: grid; place-items: center; width: 52px; height: 30px; border-radius: 999px; transition: background .2s; }
.tab-ic .ic { width: 22px; height: 22px; }
.tabs button.on { color: var(--brand); }
.tabs button.on .tab-ic { background: var(--brand-soft); }
.loading { height: 40vh; background: linear-gradient(90deg, transparent, var(--line), transparent); background-size: 200% 100%; animation: sh 1.2s infinite; border-radius: var(--radius); opacity: .6; margin-top: 1rem; }
@keyframes sh { to { background-position: -200% 0; } }
.greet { font-size: 1.05rem; font-weight: 700; color: var(--ink-2); margin: .2rem 0 .6rem; }

/* cards */
.card { background: var(--card); border-radius: var(--radius); padding: 1rem 1.05rem; box-shadow: var(--shadow); margin: .75rem 0; border: 1px solid var(--line); }
.card.cta { width: 100%; display: flex; align-items: center; gap: .85rem; text-align: start; cursor: pointer; border: 1.5px solid #cfe0fb; background: linear-gradient(135deg, #ffffff, var(--brand-softer)); transition: border-color .15s, transform .1s; }
.card.cta:hover { border-color: var(--brand); }
.card.cta:active { transform: scale(.99); }
.cta-ic { flex: 0 0 auto; width: 46px; height: 46px; border-radius: 14px; background: var(--brand); color: #fff; display: grid; place-items: center; box-shadow: 0 6px 16px rgba(21, 96, 216, .3); }
.cta-ic .ic { width: 24px; height: 24px; }
.cta-b { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.cta-t { font-size: 1.08rem; font-weight: 800; color: var(--brand-3); }
.cta-s { color: var(--muted); font-size: .88rem; }
.cta-go { color: var(--brand); }
.card.done .btn { margin-top: .7rem; }
.card.notes p, .note-line { display: flex; gap: .5rem; align-items: flex-start; margin: .25rem 0; }
.card.notes .ic, .note-line .ic { color: var(--brand); margin-top: .15em; }
.row { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.badge { display: inline-block; padding: .14rem .6rem; border-radius: 999px; font-size: .74rem; font-weight: 700; }
.badge.lv-red { background: var(--red); color: #fff; }
.badge.lv-orange { background: var(--orange-soft); color: var(--orange); }
.badge.lv-green { background: var(--green-soft); color: var(--green); }
.card.lv-red { border-inline-start: 5px solid var(--red); }
.card.lv-orange { border-inline-start: 5px solid var(--orange); }
.card.lv-green { border-inline-start: 5px solid var(--green); }

.hero { position: relative; overflow: hidden; background: linear-gradient(135deg, #2f7cf6 0%, var(--brand) 45%, var(--brand-3) 100%); color: #fff; border-radius: 22px; padding: 1.2rem 1.25rem 1.25rem; margin-top: .2rem; box-shadow: var(--shadow-lg); }
.hero::before { content: ""; position: absolute; inset-inline-end: -40px; top: -40px; width: 180px; height: 180px; border-radius: 50%; background: rgba(255, 255, 255, .08); }
.hero::after { content: ""; position: absolute; inset-inline-end: 30px; bottom: -70px; width: 140px; height: 140px; border-radius: 50%; background: rgba(255, 255, 255, .06); }
.hero > * { position: relative; }
.hero-date { opacity: .85; font-size: .88rem; text-transform: capitalize; }
.hero-big { font-size: 1.7rem; font-weight: 800; margin-top: .15rem; letter-spacing: -.01em; }
.hero-day { font-size: 1.05rem; font-weight: 600; opacity: .95; }
.hero-note { font-size: .86rem; margin-top: .45rem; opacity: .95; background: rgba(255, 255, 255, .12); display: inline-block; padding: .2rem .6rem; border-radius: 999px; }
.bar { height: 8px; background: rgba(255, 255, 255, .22); border-radius: 99px; margin-top: .7rem; overflow: hidden; }
.bar i { display: block; height: 100%; background: #fff; border-radius: 99px; }

.cures { display: grid; grid-template-columns: repeat(6, 1fr); gap: .4rem; margin: .9rem 0; }
.cdot { text-align: center; padding: .45rem .1rem; border-radius: 12px; background: var(--card); border: 1.5px solid var(--line); }
.cdot b { display: block; font-size: 1rem; color: var(--ink-2); }
.cdot small { font-size: .66rem; color: var(--muted); }
.cdot.done { background: var(--brand); border-color: var(--brand); }
.cdot.done b, .cdot.done small { color: #fff; }
.cdot.done b::after { content: " ✓"; font-size: .78rem; }
.cdot.postponed { border-style: dashed; border-color: var(--orange); }
.cdot.cur { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(21, 96, 216, .15); }
.cdot.cur b { color: var(--brand); }
.cdot.cur.done b { color: #fff; }

.phases { display: grid; gap: .55rem; }
.phase { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: .75rem .9rem; border-inline-start: 4px solid var(--brand); box-shadow: var(--shadow-sm); }
.phase.ph-nadir { border-inline-start-color: var(--red); background: var(--red-soft); }
.phase.ph-steroid, .phase.ph-nausea { border-inline-start-color: var(--orange); }
.ph-t { font-weight: 700; }
.ph-d { font-size: .9rem; color: var(--muted); }
.list .ev { display: flex; gap: .8rem; padding: .45rem 0; border-bottom: 1px solid var(--line-2); }
.list .ev:last-child { border: 0; }
.list .ev span { color: var(--brand); font-weight: 600; min-width: 6.5rem; text-transform: capitalize; font-size: .88rem; }

/* check-in */
.checkin fieldset { border: 1px solid var(--line); background: var(--card); border-radius: var(--radius); padding: .5rem 1rem .9rem; margin: .9rem 0; }
.checkin fieldset.warn { border-color: #f6c3c7; background: var(--red-soft); }
.checkin legend { font-weight: 800; color: var(--red); padding: 0 .4rem; }
.q { margin: 1rem 0; }
.q > span { display: block; font-weight: 600; margin-bottom: .4rem; color: var(--ink-2); }
.q input[type=range] { padding: 0; border: 0; accent-color: var(--brand); box-shadow: none; }
.seg { display: flex; flex-wrap: wrap; gap: .4rem; }
.seg button, .chips button { flex: 1 1 auto; min-width: 3.2rem; min-height: 42px; padding: .5rem .7rem; border-radius: 12px; border: 1.5px solid var(--line); background: var(--card); cursor: pointer; font-size: .9rem; font-weight: 500; transition: all .12s; }
.seg button:hover, .chips button:hover { border-color: #bcd2f5; }
.seg button.on, .chips button.on { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 700; }
.warn .seg button.on[data-v="1"] { background: var(--red); border-color: var(--red); }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chips button { flex: 0 1 auto; border-radius: 999px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }

/* overlays */
.overlay { position: fixed; inset: 0; background: rgba(8, 27, 60, .45); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); z-index: 20; display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.sheet { background: var(--card); width: 100%; max-width: 640px; max-height: 88dvh; overflow: auto; border-radius: 24px 24px 0 0; padding: 1.4rem 16px calc(1.2rem + env(safe-area-inset-bottom)); animation: up .22s cubic-bezier(.2, .8, .2, 1); }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(24px); opacity: .6; } }
.result { text-align: center; }
.res-level { font-size: 1.8rem; font-weight: 800; }
.result.lv-red .res-level { color: var(--red); }
.result.lv-orange .res-level { color: var(--orange); }
.result.lv-green .res-level { color: var(--green); }
.result.lv-red { border-top: 8px solid var(--red); }
.result.lv-orange { border-top: 8px solid var(--orange); }
.result.lv-green { border-top: 8px solid var(--green); }
.res-msg { font-size: 1.05rem; font-weight: 500; }
.reasons { text-align: start; padding-inline-start: 1.2rem; }
.reasons .lv-red { color: var(--red); font-weight: 700; }

/* chat */
.chat { display: flex; flex-direction: column; min-height: calc(100dvh - 240px); }
.chat-log { flex: 1; display: flex; flex-direction: column; gap: .7rem; padding: .4rem 0 1rem; }
.msg { max-width: 88%; padding: .7rem .9rem; border-radius: 18px; background: var(--card); border: 1px solid var(--line); overflow-wrap: anywhere; box-shadow: var(--shadow-sm); }
.msg p { margin: .25rem 0; }
.msg p.h { font-weight: 700; color: var(--brand-3); }
.msg ul, .msg ol { margin: .3rem 0; padding-inline-start: 1.2rem; }
.msg.me { align-self: flex-end; background: linear-gradient(180deg, #1f6ae6, var(--brand)); color: #fff; border-color: var(--brand); border-end-end-radius: 6px; }
.msg.ai { align-self: flex-start; border-end-start-radius: 6px; }
.ai-name { display: flex; align-items: center; gap: .3rem; font-size: .74rem; font-weight: 700; color: var(--brand); margin-bottom: .2rem; }
.ai-name .ic { width: 15px; height: 15px; }
.msg.ai.lv-red { border: 2px solid var(--red); }
.msg.ai.lv-orange { border: 2px solid var(--orange); }
.msg.sys { align-self: stretch; max-width: 100%; background: var(--brand-soft); border: 1px solid #d6e5fd; box-shadow: none; font-size: .88rem; color: var(--brand-3); text-align: center; border-radius: 14px; }
.msg.sys.warn { background: var(--orange-soft); border-color: #fbdcb4; color: var(--orange); }
.msg img { max-width: 100%; border-radius: 12px; display: block; margin-bottom: .3rem; }
.msg .badge { margin-bottom: .3rem; }
.typing { animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: .4; } }
.quick { display: flex; gap: .45rem; overflow-x: auto; padding: .3rem 0; scrollbar-width: none; }
.quick::-webkit-scrollbar { display: none; }
.quick button { flex: 0 0 auto; border: 1.5px solid #cfe0fb; color: var(--brand-2); background: var(--card); border-radius: 999px; padding: .42rem .9rem; font-size: .85rem; font-weight: 600; cursor: pointer; }
.quick button:hover { background: var(--brand-soft); }
.composer { position: sticky; bottom: calc(70px + env(safe-area-inset-bottom)); display: flex; gap: .4rem; align-items: flex-end; background: var(--card); padding: .4rem; margin-top: .3rem; border: 1.5px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); }
.composer:focus-within { border-color: var(--brand); }
.composer textarea { margin: 0; resize: none; max-height: 140px; border: 0; padding: .6rem .4rem; box-shadow: none; background: transparent; }
.composer textarea:focus { box-shadow: none; }
.composer .grow { flex: 1; min-width: 0; }
.composer .photo { margin: 0; font-weight: 400; color: var(--muted); flex: 0 0 auto; }
.btn.send { width: 44px; height: 44px; padding: 0; border-radius: 14px; flex: 0 0 auto; }
.btn.send .ic { width: 20px; height: 20px; }
.prev { position: relative; display: inline-block; margin: .3rem .3rem 0; }
.prev img { height: 70px; border-radius: 10px; }
.prev button { position: absolute; top: -6px; inset-inline-end: -6px; border: 0; background: var(--ink); color: #fff; border-radius: 50%; width: 22px; height: 22px; cursor: pointer; font-size: .7rem; }

/* history */
.hist .row { margin-bottom: .2rem; }

/* calendar */
.legend { display: flex; flex-wrap: wrap; gap: .8rem; font-size: .8rem; color: var(--muted); margin-bottom: .4rem; }
.lg::before { content: ""; display: inline-block; width: 12px; height: 12px; border-radius: 4px; margin-inline-end: .35rem; vertical-align: -1px; }
.lg.cureday::before { background: var(--brand); }
.lg.nadir::before { background: var(--nadir); }
.lg.today::before { outline: 2px solid var(--brand-3); outline-offset: -2px; }
.month { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem; margin: .8rem 0; box-shadow: var(--shadow); }
.month h3 { margin: .1rem .2rem .6rem; text-transform: capitalize; color: var(--brand-3); }
.grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.dow { text-align: center; font-size: .7rem; font-weight: 700; color: var(--muted); padding-bottom: .25rem; }
.cell { position: relative; aspect-ratio: 1 / 1.05; border: 0; border-radius: 10px; background: transparent; padding: 2px; display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; line-height: 1.1; color: var(--ink); }
.cell b { font-size: .92rem; font-weight: 600; }
.cell small { font-size: .6rem; color: var(--muted); }
.cell.c1 { background: var(--c1); } .cell.c2 { background: var(--c2); } .cell.c3 { background: var(--c3); }
.cell.c4 { background: var(--c4); } .cell.c5 { background: var(--c5); } .cell.c6 { background: var(--c6); }
.cell.nadir { box-shadow: inset 0 -4px 0 var(--nadir); }
.cell.cureday { background: var(--brand); color: #fff; box-shadow: 0 4px 10px rgba(21, 96, 216, .3); }
.cell.cureday small { color: #fff; opacity: .9; }
.cell.today { outline: 2.5px solid var(--brand-3); outline-offset: -1px; z-index: 1; }
.cell.past { opacity: .6; }
.cell .dot { position: absolute; top: 4px; inset-inline-end: 4px; width: 8px; height: 8px; border-radius: 50%; }
.dot.lv-red { background: var(--red); } .dot.lv-orange { background: var(--orange); } .dot.lv-green { background: var(--green); }
.cell em { position: absolute; bottom: 1px; font-style: normal; font-size: .9rem; color: var(--brand); line-height: 1; }
.sheet.day h2 { color: var(--ink); text-transform: capitalize; margin-top: 0; font-size: 1.15rem; letter-spacing: 0; }

/* admin */
.admin main { max-width: 1140px; padding-bottom: 40px; }
.admin .top .title { font-size: 1.05rem; }
.admin .tabs-top { display: flex; gap: .35rem; flex-wrap: wrap; margin: .8rem 0 1rem; }
.admin .tabs-top button { border: 1.5px solid var(--line); background: var(--card); border-radius: 999px; padding: .4rem 1rem; cursor: pointer; font-weight: 600; font-size: .9rem; color: var(--ink-2); }
.admin .tabs-top button:hover { border-color: #bcd2f5; }
.admin .tabs-top button.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .7rem; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: .9rem 1rem; box-shadow: var(--shadow-sm); }
.stat b { display: block; font-size: 1.5rem; color: var(--brand-3); letter-spacing: -.01em; }
.stat span { color: var(--muted); font-size: .8rem; }
.tbl { width: 100%; border-collapse: collapse; font-size: .88rem; background: var(--card); }
.tbl th, .tbl td { text-align: start; padding: .55rem .6rem; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.tbl th { color: var(--muted); font-weight: 700; font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; background: var(--brand-softer); }
.tbl tr:hover td { background: #fafcff; }
.tblwrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-sm); }
.pre { white-space: pre-wrap; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .78rem; max-height: 9rem; overflow: auto; margin: 0; }
.filters { display: flex; gap: .4rem; flex-wrap: wrap; margin: .5rem 0; }
.filters input, .filters select { width: auto; flex: 1 1 140px; margin: 0; padding: .5rem .7rem; }
.threads { display: grid; grid-template-columns: 240px 1fr; gap: .9rem; }
.threads .tl button { display: block; width: 100%; text-align: start; border: 1.5px solid var(--line); background: var(--card); border-radius: 12px; padding: .55rem .75rem; margin-bottom: .4rem; cursor: pointer; }
.threads .tl button.on { border-color: var(--brand); background: var(--brand-soft); }
.meta { font-size: .72rem; color: var(--muted); margin-top: .3rem; }
textarea.big { min-height: 60vh; font-family: ui-monospace, Menlo, monospace; font-size: .85rem; }
@media (max-width: 700px) { .threads { grid-template-columns: 1fr; } }

/* documents */
.docs .doc { display: flex; gap: .75rem; align-items: center; padding: .6rem 0; border-bottom: 1px solid var(--line-2); color: inherit; text-decoration: none; }
.docs .doc:last-child { border: 0; }
.docs .doc:hover b { color: var(--brand); }
.doc-ic { flex: 0 0 2.7rem; height: 2.7rem; border-radius: 10px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-size: .68rem; font-weight: 800; letter-spacing: .03em; }
.doc-b { display: flex; flex-direction: column; min-width: 0; }
.doc-b b { font-weight: 600; overflow-wrap: anywhere; }
.doc-b small { color: var(--muted); }
.add-doc summary { cursor: pointer; color: var(--brand); display: flex; align-items: center; gap: .4rem; list-style: none; }
.add-doc summary::-webkit-details-marker { display: none; }
.filepick { margin-top: .4rem; }

@media (min-width: 700px) {
  main { padding-top: 22px; }
  .hero { padding: 1.5rem 1.6rem; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* voice */
.icon-btn.mic { color: var(--brand); flex: 0 0 auto; }
.icon-btn.mic.on { background: var(--red); color: #fff; animation: pulse 1.4s infinite; }
.icon-btn.mic:disabled { opacity: .4; }
#voicebar { display: flex; align-items: center; gap: .5rem; padding: .35rem .4rem 0; color: var(--brand-3); flex-wrap: wrap; }
#voicebar .ic { color: var(--brand); }
#voicebar > .small, #voicebar > .typing { flex: 1; min-width: 0; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--red); animation: pulse 1s infinite; }
.rec-t { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--red); }
.linkish { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: .82rem; font-weight: 600; margin-inline-start: auto; display: inline-flex; padding: .2rem; }
.voice-tag { display: flex; align-items: center; gap: .3rem; font-size: .74rem; font-weight: 700; opacity: .9; margin-bottom: .25rem; }
.voice-tag .ic { width: 14px; height: 14px; }
.msg audio { display: block; width: 100%; min-width: 220px; height: 36px; margin: .2rem 0 .35rem; }

/* ready-to-send message for the doctor */
.docmsg { margin: .7rem 0 .3rem; border: 1.5px solid #cfe0fb; background: var(--brand-softer); border-radius: 14px; overflow: hidden; }
.docmsg-h { display: flex; align-items: center; gap: .4rem; padding: .5rem .75rem; background: var(--brand-soft); color: var(--brand-3); font-size: .82rem; }
.docmsg-h .ic { color: var(--brand); width: 16px; height: 16px; }
.docmsg-t { padding: .65rem .8rem; white-space: pre-wrap; font-size: .92rem; line-height: 1.5; background: var(--card); direction: ltr; text-align: left; }
.docmsg-a { display: flex; gap: .5rem; padding: .55rem .6rem; }
.docmsg-a .btn { flex: 1; min-height: 42px; padding: .5rem .6rem; font-size: .9rem; }
.docmsg.drafting { padding: .5rem .8rem; }

/* listen */
.msg-foot { display: flex; margin-top: .45rem; padding-top: .45rem; border-top: 1px solid var(--line-2); }
.listen { display: inline-flex; align-items: center; gap: .35rem; border: 1.5px solid #cfe0fb; background: var(--brand-softer); color: var(--brand); border-radius: 999px; padding: .3rem .8rem; font-size: .82rem; font-weight: 700; cursor: pointer; min-height: 34px; }
.listen .ic { width: 17px; height: 17px; }
.listen.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.listen.on .ic { animation: pulse 1.2s infinite; }
