/* ============ РодДом Связь — приложение для мам ============ */
/* Палитра сохранена: акцент #0F4C81, фон #F3F6FA, бабблы #fff / #E4EFF8 */

:root {
  --accent: #0F4C81;
  --accent-dark: #0A3558;
  --accent-soft: #E4EFF8;
  --accent-soft-2: #fff0f5;
  --bg: #F3F6FA;
  --card: #ffffff;
  --bubble-in: #ffffff;
  --bubble-out: #E4EFF8;
  --text: #22262e;
  --muted: #8b93a1;
  --border: #DDE5EE;
  --danger: #fa5252;
  --danger-soft: #fff0f0;
  --ok: #2b8a3e;
  --warn: #e8890c;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-pill: 999px;
  --sh-1: 0 1px 2px rgba(34, 38, 46, .05);
  --sh-2: 0 4px 14px rgba(15, 76, 129, .10);
  --sh-3: 0 10px 34px rgba(15, 76, 129, .18);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; margin: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.45;
  height: 100dvh;
  overflow: hidden;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 13.5px; line-height: 1.45; }
h1 { font-size: 22px; font-weight: 700; letter-spacing: -.2px; }
h2 { color: var(--accent-dark); font-size: 19px; font-weight: 700; margin-bottom: 10px; }
h3 { font-size: 15.5px; font-weight: 700; }

.screen { height: 100dvh; display: flex; flex-direction: column; width: 100%; max-width: 100%; overflow-x: hidden; }
/* На широких экранах — «телефонная» колонка по центру */
@media (min-width: 760px) {
  body { background: #f3e6ec; }
  .screen { max-width: 480px; margin: 0 auto; background: var(--bg); box-shadow: 0 0 0 1px rgba(0,0,0,.04), 0 18px 60px rgba(10,53,88,.16); }
}

/* ---------- Вход ---------- */
#screen-login { align-items: center; justify-content: center; padding: 24px; }
.login-card {
  width: 100%; max-width: 380px; background: var(--card);
  border-radius: var(--r-lg); padding: 30px 24px;
  box-shadow: var(--sh-3); display: flex; flex-direction: column; gap: 12px;
  border: 1px solid rgba(15, 76, 129, .06);
}
.logo {
  width: 64px; height: 64px; margin: 0 auto 2px; border-radius: 50%;
  display: grid; place-items: center; font-size: 30px; color: #fff;
  background: linear-gradient(135deg, var(--accent), #f06595);
  box-shadow: 0 8px 22px rgba(15, 76, 129, .35);
}
.login-card h1 { text-align: center; }
.login-card > .muted { text-align: center; margin-bottom: 4px; }
.login-card input[type=text], .login-card input[type=tel] {
  padding: 14px 15px; border: 1.5px solid var(--border); border-radius: var(--r-md);
  font-size: 16px; background: #fff; transition: border-color .15s, box-shadow .15s;
}
.login-card input[type=text]:focus, .login-card input[type=tel]:focus,
.composer input:focus, .search-box:focus, .report-box textarea:focus,
.rec-l input:focus, .rec-l select:focus, .date-in:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(15, 76, 129, .12);
}
.consent { display: flex; gap: 9px; font-size: 13px; color: #6b7280; align-items: flex-start; line-height: 1.4; }
.consent input { margin-top: 2px; accent-color: var(--accent); width: 16px; height: 16px; }
.emergency-note {
  font-size: 13px; color: #c2255c; text-align: center; background: var(--accent-soft-2);
  border-radius: var(--r-md); padding: 11px 12px; line-height: 1.5;
}

/* ---------- Кнопки ---------- */
.btn {
  border: none; border-radius: var(--r-md); font-size: 16px; font-weight: 600;
  padding: 14px; cursor: pointer; transition: transform .06s, box-shadow .15s, background .15s;
  font-family: inherit;
}
.btn.primary {
  background: linear-gradient(135deg, var(--accent), #1B6FA8); color: #fff;
  box-shadow: 0 6px 18px rgba(15, 76, 129, .30);
}
.btn.primary:hover { box-shadow: 0 8px 22px rgba(15, 76, 129, .38); }
.btn.primary:active, .btn.emergency:active { transform: scale(.985); }
.btn.primary:disabled { opacity: .55; box-shadow: none; cursor: default; }
.btn.emergency { background: var(--danger); color: #fff; padding: 12px 14px; box-shadow: 0 4px 12px rgba(250, 82, 82, .28); }
.btn.ghost {
  background: #fff; border: 1.5px solid var(--accent); color: var(--accent);
  width: 100%; margin-top: 12px; font-weight: 600;
}
.btn.ghost:hover { background: var(--accent-soft-2); }

/* ---------- Шапка ---------- */
.appbar {
  background: linear-gradient(135deg, var(--accent), #1B6FA8); color: #fff;
  padding: 15px 18px; padding-top: calc(15px + var(--safe-top));
  font-weight: 700; font-size: 16.5px; letter-spacing: .1px;
  box-shadow: 0 4px 16px rgba(15, 76, 129, .28);
  display: flex; align-items: center; gap: 10px; z-index: 5;
}
.appbar::before {
  content: "♥"; display: grid; place-items: center; width: 26px; height: 26px;
  border-radius: 50%; background: rgba(255,255,255,.22); font-size: 13px;
}
.pane { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

/* ---------- Чат ---------- */
.msg-list { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 16px 14px 8px; display: flex; flex-direction: column; gap: 9px; }
.msg {
  max-width: 82%; padding: 11px 15px; border-radius: 18px; font-size: 15px;
  line-height: 1.42; word-wrap: break-word; overflow-wrap: anywhere; animation: pop .18s ease-out;
  white-space: pre-wrap;
}
@keyframes pop { from { opacity: 0; transform: translateY(4px); } }
.msg .time { display: block; font-size: 11px; opacity: .5; margin-top: 5px; }
.msg.in {
  background: var(--bubble-in); align-self: flex-start; border-bottom-left-radius: 6px;
  box-shadow: var(--sh-1); border: 1px solid var(--border);
}
.msg.out { background: var(--bubble-out); align-self: flex-end; border-bottom-right-radius: 6px; color: #7a1039; }
.msg.emergency {
  background: var(--danger-soft); border: 2px solid var(--danger); align-self: center;
  text-align: center; font-weight: 600; color: #c92a2a; max-width: 92%; border-radius: var(--r-md);
}
.composer {
  display: flex; gap: 8px; padding: 10px 12px; background: #fff;
  border-top: 1px solid var(--border); padding-bottom: calc(10px + var(--safe-bottom));
  align-items: center;
}
.composer input {
  flex: 1; min-width: 0; border: 1.5px solid var(--border); border-radius: var(--r-pill);
  padding: 12px 18px; font-size: 16px; background: #fbfbfc; transition: border-color .15s, box-shadow .15s;
}
.composer .btn.primary {
  border-radius: 50%; width: 46px; height: 46px; padding: 0; flex: 0 0 46px;
  display: grid; place-items: center; font-size: 18px;
}
.composer .btn.emergency { border-radius: 50%; width: 46px; height: 46px; flex: 0 0 46px; display: grid; place-items: center; font-size: 18px; }

/* ---------- Нижнее меню ---------- */
.tabbar {
  display: flex; background: #fff; border-top: 1px solid var(--border);
  padding: 6px 4px calc(6px + var(--safe-bottom)); box-shadow: 0 -2px 12px rgba(34,38,46,.04);
}
.tab {
  flex: 1 1 0; min-width: 0; border: none; background: none; padding: 6px 2px; font-size: 11px; color: #9aa1ad;
  line-height: 1.2; display: flex; flex-direction: column; align-items: center; gap: 2px;
  cursor: pointer; border-radius: var(--r-md); transition: color .15s, background .15s;
  font-family: inherit; overflow: hidden;
}
.tab .ico { font-size: 19px; line-height: 1; }
.tab .lbl { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tab.active { color: var(--accent); font-weight: 700; background: var(--accent-soft-2); }

/* ---------- Контентные панели ---------- */
.scroll-pad { flex: 1; overflow-y: auto; padding: 16px; }
.info-scroll { flex: 1; overflow-y: auto; padding: 18px; }
.info-scroll h2 { color: var(--accent); font-size: 17px; margin: 16px 0 8px; }
.info-scroll ul { padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 15px; }
.date-in {
  width: 100%; padding: 13px; border: 1.5px solid var(--border); border-radius: var(--r-md);
  font-size: 16px; margin: 10px 0; font-family: inherit;
}

/* ---------- Срок ---------- */
.week-hero {
  background: linear-gradient(135deg, var(--accent), #f06595); color: #fff;
  border-radius: var(--r-lg); padding: 24px 20px; margin-bottom: 14px;
  box-shadow: 0 10px 30px rgba(15, 76, 129, .30); position: relative; overflow: hidden;
}
.week-hero::after {
  content: ""; position: absolute; right: -30px; top: -30px; width: 120px; height: 120px;
  border-radius: 50%; background: rgba(255,255,255,.12);
}
.week-num { font-size: 44px; font-weight: 800; letter-spacing: -1px; }
.week-num span { font-size: 17px; font-weight: 500; opacity: .92; }
.week-due { margin-top: 8px; font-size: 14px; opacity: .96; position: relative; }

.card {
  background: var(--card); border-radius: var(--r-md); padding: 15px 17px; margin-bottom: 12px;
  box-shadow: var(--sh-1); border: 1px solid var(--border);
}
.card h3 { font-size: 15px; margin-bottom: 7px; }
.card p { font-size: 14.5px; line-height: 1.5; }
.card.highlight { border: 1.5px solid var(--accent); background: linear-gradient(180deg, #fffafc, var(--accent-soft-2)); }
.checkup { font-size: 14px; padding: 9px 0; border-bottom: 1px solid #f7f1f4; }
.checkup:last-child { border-bottom: none; }
.checkup.now { background: var(--accent-soft-2); border-radius: var(--r-sm); padding: 9px 11px; margin: 4px -6px; border-bottom: none; font-weight: 600; }

/* ---------- Библиотека ---------- */
.search-box {
  width: 100%; padding: 13px 16px; border: 1.5px solid var(--border); border-radius: var(--r-pill);
  font-size: 15px; margin-bottom: 16px; background: #fff; font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.lib-cat {
  font-weight: 800; font-size: 12.5px; color: var(--accent-dark); margin: 18px 0 8px;
  text-transform: uppercase; letter-spacing: .6px;
}
.lib-art {
  background: var(--card); border-radius: var(--r-md); padding: 13px 15px; font-size: 15px;
  margin-bottom: 7px; cursor: pointer; box-shadow: var(--sh-1); border: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center; gap: 10px; transition: background .12s, transform .06s;
}
.lib-art::after { content: "›"; color: var(--accent); font-size: 20px; font-weight: 700; line-height: 1; }
.lib-art:hover { background: var(--accent-soft-2); }
.lib-art:active { transform: scale(.995); }
.article-body {
  font-size: 15px; line-height: 1.6; background: var(--card); border-radius: var(--r-md);
  padding: 17px; border: 1px solid var(--border); box-shadow: var(--sh-1);
}
.disclaimer { font-size: 12px; color: var(--muted); margin-top: 10px; line-height: 1.5; }
.diet-list { display: flex; flex-direction: column; gap: 5px; }
.diet-item {
  background: var(--card); border-radius: var(--r-sm); padding: 9px 13px; font-size: 14px;
  border: 1px solid var(--border); display: flex; justify-content: space-between; gap: 8px;
}

/* ---------- Расшифровка анализов ---------- */
.report-box { margin-top: 22px; background: var(--card); border-radius: var(--r-md); padding: 17px; border: 1px solid var(--border); box-shadow: var(--sh-1); }
.report-box h3 { font-size: 16px; margin-bottom: 6px; }
.report-box textarea {
  width: 100%; border: 1.5px solid var(--border); border-radius: var(--r-md); padding: 11px;
  font-size: 14px; font-family: inherit; margin: 9px 0; resize: vertical; transition: border-color .15s, box-shadow .15s;
}
#report-out { background: var(--accent-soft-2); border-radius: var(--r-md); padding: 13px; font-size: 14.5px; line-height: 1.55; margin-top: 10px; }

/* ---------- Запись к врачу ---------- */
.book-box { display: flex; gap: 8px; margin: 8px 0 10px; }
.book-box select {
  flex: 1; border: 1.5px solid var(--border); border-radius: var(--r-sm); padding: 10px;
  font-size: 14px; background: #fff; font-family: inherit;
}
.book-box .book-go { width: auto; padding: 0 16px; border-radius: var(--r-sm); font-size: 14px; }
.book-none { font-size: 13.5px; margin: 6px 0 8px; }
.appt-status { font-size: 14px; font-weight: 700; }
.appt-status.pending { color: var(--warn); }
.appt-status.confirmed { color: var(--ok); }
.appt-status.rejected, .appt-status.cancelled { color: var(--muted); }

/* ---------- Анкета ---------- */
.rec-sec {
  font-weight: 800; color: var(--accent-dark); font-size: 13px; margin: 20px 0 10px;
  text-transform: uppercase; letter-spacing: .5px; border-bottom: 1.5px solid var(--accent-soft);
  padding-bottom: 6px;
}
.rec-l { display: block; font-size: 13px; color: #6b7280; margin-bottom: 11px; font-weight: 500; }
.rec-l input, .rec-l select {
  display: block; width: 100%; margin-top: 4px; padding: 11px 13px;
  border: 1.5px solid var(--border); border-radius: var(--r-sm); font-size: 15px; background: #fff;
  font-family: inherit; transition: border-color .15s, box-shadow .15s; color: var(--text);
}
.rec-row { display: flex; gap: 10px; }
.rec-row .rec-l { flex: 1; }
.rec-row4 { display: flex; gap: 8px; }
.rec-row4 .rec-l { flex: 1; }
.rec-checks { display: flex; flex-wrap: wrap; gap: 9px 16px; font-size: 14px; margin-bottom: 12px; }
.rec-checks label {
  display: flex; align-items: center; gap: 6px; background: #fff; border: 1px solid var(--border);
  padding: 7px 11px; border-radius: var(--r-pill); cursor: pointer;
}
.rec-checks input { accent-color: var(--accent); width: 15px; height: 15px; }
.bmi-box {
  background: linear-gradient(135deg, var(--accent-soft-2), var(--accent-soft)); border-radius: var(--r-md);
  padding: 12px 15px; font-size: 14px; font-weight: 700; color: var(--accent-dark); margin-bottom: 11px;
  border: 1px solid rgba(15,76,129,.12);
}
.rec-saved { text-align: center; color: var(--ok); font-weight: 700; margin-top: 12px; }

/* ---------- Узкие экраны ---------- */
@media (max-width: 380px) {
  .tab { font-size: 10px; padding: 5px 0; }
  .tab .ico { font-size: 17px; }
  .msg { max-width: 88%; font-size: 14.5px; }
  .composer input { padding: 11px 14px; }
  .composer .btn.primary, .composer .btn.emergency { width: 42px; height: 42px; flex: 0 0 42px; }
  .appbar { font-size: 15.5px; padding-left: 14px; padding-right: 14px; }
  .scroll-pad { padding: 13px; }
}

/* ---------- Скроллбар ---------- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(15, 76, 129, .22); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: rgba(15, 76, 129, .35); }
::-webkit-scrollbar-track { background: transparent; }

.fb{margin-top:4px;display:flex;gap:6px}.fb button{border:1px solid #ddd;background:#fff;border-radius:10px;padding:2px 8px;font-size:12px;cursor:pointer}.fb button:hover{background:#f5f5f5}

/* ===== Web layout: site style, not mobile app ===== */
body { background: #f4f6f8; }
#screen-login, #screen-main {
  height: auto; min-height: 100vh; max-width: none; margin: 0;
  box-shadow: none; background: transparent; overflow: visible;
}
#screen-login { display: flex; align-items: center; justify-content: center; padding: 48px 20px; }
.login-card { max-width: 420px; }
#screen-main { display: flex; flex-direction: column; }

.appbar {
  order: 0; background: #fff; color: var(--text); box-shadow: none;
  border-bottom: 1px solid var(--border); padding: 0 24px; height: 64px;
  display: flex; align-items: center; gap: 10px; font-size: 18px;
}
.appbar #tab-title { color: var(--accent); }
.appbar::before { background: var(--accent-soft); color: var(--accent); }
.appbar #btn-logout { color: var(--accent); border: 1px solid var(--border); background: #fff; }

.tabbar {
  order: 1; position: static; display: flex; justify-content: center; gap: 4px;
  padding: 8px 16px; background: #fff; border-top: none;
  border-bottom: 1px solid var(--border); box-shadow: none; overflow-x: auto;
}
.tab {
  flex: 0 0 auto; flex-direction: row; gap: 7px; padding: 10px 14px;
  font-size: 14px; border-radius: 10px; color: #6b7280;
}
.tab .ico { font-size: 16px; }
.tab.active { background: var(--accent-soft); color: var(--accent); }

.pane {
  order: 2; flex: 0 0 auto; overflow: visible; width: 100%;
  max-width: 1080px; margin: 0 auto; padding: 24px 20px 40px;
}
#pane-chat {
  max-width: 900px; padding: 0; background: #fff; overflow: hidden;
  border: 1px solid var(--border); border-radius: 16px;
  box-shadow: 0 4px 18px rgba(0,0,0,.04);
}
#pane-chat .msg-list { max-height: calc(100vh - 320px); min-height: 340px; }
#pane-chat .composer { padding-bottom: 12px; }

.scroll-pad { overflow: visible; padding: 0; max-width: 1000px; margin: 0 auto; }
.info-scroll { overflow: visible; padding: 0; max-width: 1000px; margin: 0 auto; }
.report-box { margin-top: 0; }

@media (max-width: 700px) {
  .appbar { padding: 0 14px; height: 56px; font-size: 16px; }
  .tabbar { justify-content: flex-start; padding: 6px 10px; }
  .tab { padding: 8px 10px; font-size: 12px; }
  .pane { padding: 14px 12px 28px; }
  #pane-chat { border-radius: 12px; }
  #pane-chat .msg-list { max-height: none; min-height: 45vh; }
  .login-card { padding: 26px 18px; }
}

/* header/nav polish */
.appbar #tab-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appbar #btn-logout { flex: 0 0 auto; width: auto; margin-left: auto; padding: 6px 14px; }
@media (max-width: 700px) {
  .tabbar { flex-wrap: wrap; justify-content: center; }
  .tab { padding: 7px 8px; font-size: 11.5px; gap: 5px; }
  .appbar #tab-title { font-size: 15px; }
}


/* chat card fills the viewport, composer pinned to its bottom */
#pane-chat {
  height: calc(100dvh - 182px);
  min-height: 420px;
  display: flex;
  flex-direction: column;
}
#pane-chat .msg-list { flex: 1 1 auto; max-height: none; min-height: 0; }
#pane-chat .composer { flex: 0 0 auto; }
@media (max-width: 700px) {
  #pane-chat { height: calc(100dvh - 175px); min-height: 420px; }
}

/* surveys */
.modal-ov { position:fixed; inset:0; background:rgba(15,23,42,.45); display:flex; align-items:center; justify-content:center; padding:16px; z-index:60; }
.modal-ov.hidden { display:none; }
.survey-card { background:#fff; border-radius:16px; padding:20px; max-width:640px; width:100%; max-height:85vh; overflow:auto; box-shadow:0 20px 60px rgba(0,0,0,.25); }
.survey-card h3 { margin-bottom:12px; color:var(--accent); }
.survey-q { margin:14px 0; }
.survey-q label.sq-l { font-weight:600; display:block; margin-bottom:6px; }
.survey-q textarea, .survey-q input[type=text] { width:100%; padding:10px; border:1px solid var(--border); border-radius:8px; font:inherit; }
.survey-q .opt { display:flex; gap:8px; align-items:center; margin:6px 0; font-weight:400; }
.survey-card .rules-actions { display:flex; gap:8px; margin-top:14px; }


/* survey chat button + scrollable modal */
.msg .survey-go { margin-top: 8px; width: 100%; }
.modal-ov { align-items: flex-start; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom)); }
.survey-card { max-height: calc(100dvh - 32px); overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
.survey-card .rules-actions { position: sticky; bottom: 0; background: #fff; padding: 12px 0 4px; border-top: 1px solid var(--border); }

body.modal-open { overflow: hidden; }
@media (max-width: 700px) {
  .modal-ov { display:block; overflow-y:auto; -webkit-overflow-scrolling:touch; padding:12px; }
  .survey-card { max-height:none; overflow:visible; margin:0 auto; }
  .survey-card .rules-actions { position:static; }
}

/* ===== Chat layout polish ===== */
.appbar #tab-title { flex: 1 1 auto; min-width: 0; }
.appbar #btn-logout { flex: 0 0 auto; width: auto; margin-left: 8px; }
.chat-head {
  display: flex; align-items: center; gap: 10px; padding: 13px 18px;
  border-bottom: 1px solid var(--border); background: #fff; flex: 0 0 auto;
}
.chat-avatar {
  width: 40px; height: 40px; border-radius: 50%; background: var(--accent-soft);
  display: grid; place-items: center; font-size: 19px; flex: 0 0 auto;
}
.chat-head-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.chat-head-text b { font-size: 14.5px; color: var(--text); }
.chat-head-text span { font-size: 12px; color: #16a34a; display: flex; align-items: center; gap: 5px; }
.chat-head-text i { width: 7px; height: 7px; border-radius: 50%; background: #22c55e; display: inline-block; }
.chat-survey-btn {
  margin-left: auto; width: auto; flex: 0 0 auto; padding: 7px 12px;
  border-radius: 9px; font-size: 12.5px; font-weight: 600; cursor: pointer;
  background: #F1F7FC; color: var(--accent); border: 1px solid #C9D9E8;
}
.chat-survey-btn:hover { background: #ffe4ef; }
#pane-chat {
  max-width: 1040px; width: calc(100% - 40px);
  height: calc(100dvh - 182px); min-height: 420px;
}
@media (min-width: 760px) { .msg { max-width: 68%; } }
@media (max-width: 700px) {
  .chat-head { padding: 10px 12px; gap: 8px; }
  .chat-avatar { width: 34px; height: 34px; font-size: 16px; }
  .chat-head-text b { font-size: 13.5px; }
  .chat-survey-btn { padding: 6px 9px; font-size: 11.5px; }
  #pane-chat { width: 100%; }
}

/* ===== Separate surveys tab ===== */
.surveys-page {
  max-width: 1000px; margin: 0 auto; background: #fff; border: 1px solid var(--border);
  border-radius: 16px; padding: 24px; box-shadow: 0 4px 18px rgba(0,0,0,.04);
}
.surveys-page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.surveys-page-icon {
  width: 44px; height: 44px; border-radius: 13px; background: var(--accent-soft);
  display: grid; place-items: center; font-size: 20px; flex: 0 0 auto;
}
.surveys-page-head h2 { margin: 0; font-size: 20px; }
.surveys-page-head p { margin: 3px 0 0; font-size: 13px; color: #7b8494; }
.surveys-list { display: flex; flex-direction: column; gap: 10px; }
.surveys-item {
  display: flex; align-items: center; gap: 12px; border: 1px solid #e9ecf1;
  border-radius: 13px; padding: 13px; background: #fff;
}
.surveys-item-icon {
  width: 38px; height: 38px; border-radius: 11px; background: #F1F7FC;
  display: grid; place-items: center; font-size: 18px; flex: 0 0 auto;
}
.surveys-item-main { flex: 1; min-width: 0; }
.surveys-item-main b { font-size: 14px; }
.surveys-item-meta { font-size: 12px; color: #8a93a3; margin-top: 3px; }
.surveys-item .btn { width: auto; flex: 0 0 auto; padding: 8px 12px; font-size: 12px; }
.surveys-empty { padding: 36px 16px; text-align: center; color: #8a93a3; }
.surveys-empty-icon { font-size: 34px; margin-bottom: 6px; }
.surveys-empty b { display: block; color: #4b5563; margin-bottom: 3px; }
.surveys-empty p { margin: 0; font-size: 13px; }
@media (max-width: 700px) {
  .surveys-page { padding: 16px; border-radius: 12px; }
  .surveys-page-head h2 { font-size: 18px; }
  .surveys-item { flex-wrap: wrap; }
  .surveys-item .btn { width: 100%; }
}

/* allow long pages to scroll */
html { height: auto; min-height: 100%; overflow-y: auto; }
body { height: auto; min-height: 100%; overflow-y: auto; }
body.modal-open { overflow: hidden; }

/* ===== Website header + chat rail ===== */
.site-header {
  order: -1; height: 76px; flex: 0 0 auto; background: #fff;
  border-bottom: 1px solid var(--border); display: flex; align-items: center;
  justify-content: space-between; gap: 16px; padding: 0 32px;
}
.site-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.site-logo { width: 42px; height: 42px; border-radius: 12px; background: var(--accent-soft); display: grid; place-items: center; font-size: 21px; flex: 0 0 auto; }
.site-brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.site-brand-text b { font-size: 18px; color: var(--accent-dark); letter-spacing: .2px; }
.site-brand-text span { font-size: 12px; color: #8a93a3; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.site-badge { background: #F1F7FC; color: var(--accent); border: 1px solid #C9D9E8; border-radius: 999px; padding: 7px 12px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.appbar { height: 48px; padding: 0 32px; font-size: 15px; }
#pane-chat { max-width: 1320px; width: calc(100% - 40px); height: calc(100dvh - 242px); display: block; padding: 0; background: transparent; border: none; box-shadow: none; overflow: visible; }
.chat-shell { display: grid; grid-template-columns: minmax(0,1fr) 300px; gap: 18px; height: 100%; }
.chat-card { display: flex; flex-direction: column; min-height: 0; background: #fff; border: 1px solid var(--border); border-radius: 16px; overflow: hidden; box-shadow: 0 4px 18px rgba(0,0,0,.04); }
.chat-card .msg-list { flex: 1 1 auto; max-height: none; min-height: 0; }
.chat-rail { display: flex; flex-direction: column; gap: 12px; overflow-y: auto; min-height: 0; }
.rail-card { background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 16px; box-shadow: 0 4px 14px rgba(0,0,0,.03); }
.rail-title { font-size: 10.5px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; color: #9aa1ad; margin-bottom: 8px; }
.rail-big { font-size: 26px; font-weight: 800; color: var(--accent); line-height: 1.1; }
.rail-sub { font-size: 12px; color: #8a93a3; margin-top: 6px; }
.rail-actions { display: flex; flex-direction: column; gap: 6px; }
.rail-actions button { text-align: left; border: 1px solid #e9ecf1; background: #fff; color: #4b5563; border-radius: 9px; padding: 9px 11px; font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.rail-actions button:hover { background: #F1F7FC; border-color: #C9D9E8; color: var(--accent); }
.rail-tip { background: #fff7fa; border-color: #C9D9E8; color: #6b5560; font-size: 12.5px; line-height: 1.55; }
@media (max-width: 900px) {
  .site-header { height: 62px; padding: 0 16px; }
  .site-logo { width: 36px; height: 36px; font-size: 18px; }
  .site-brand-text b { font-size: 16px; }
  .site-brand-text span { display: none; }
  .site-badge { display: none; }
  .appbar { height: 52px; padding: 0 16px; }
  .chat-rail { display: none; }
  .chat-shell { display: block; }
  #pane-chat { width: 100%; height: calc(100dvh - 232px); }
  .chat-card { height: 100%; }
}

/* ===== University login ===== */
.login-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 40px 20px; background: radial-gradient(900px 500px at 20% 0%, #E4EFF8, #F3F6FA 70%);
}
.login-shell {
  width: min(1080px, 100%); display: grid; grid-template-columns: 1.05fr .95fr;
  background: #fff; border-radius: 24px; overflow: hidden; border: 1px solid #DDE5EE;
  box-shadow: 0 30px 80px rgba(10, 53, 88, .16);
}
.login-brand {
  background: linear-gradient(145deg, #0A3558 0%, #0F4C81 58%, #1B6FA8 100%);
  color: #fff; padding: 44px; display: flex; flex-direction: column; justify-content: space-between;
  gap: 28px; position: relative; overflow: hidden;
}
.login-brand::after {
  content: ""; position: absolute; width: 320px; height: 320px; border-radius: 50%;
  right: -110px; bottom: -120px; background: rgba(255,255,255,.06);
  box-shadow: 0 0 0 40px rgba(255,255,255,.04), 0 0 0 80px rgba(255,255,255,.03);
}
.login-brand-top { display: flex; align-items: center; gap: 12px; position: relative; z-index: 1; }
.univ-mark {
  width: 52px; height: 52px; border-radius: 14px; background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.26); display: grid; place-items: center;
  font-size: 12px; font-weight: 800; letter-spacing: .5px; color: #fff; flex: 0 0 auto;
}
.univ-kicker { font-size: 11px; line-height: 1.45; color: rgba(255,255,255,.72); text-transform: uppercase; letter-spacing: .55px; }
.login-dept { color: #C8A24A; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 10px; }
.login-brand h1 { font-family: Georgia, "Times New Roman", serif; font-size: 38px; font-weight: 700; margin: 0 0 12px; color: #fff; }
.login-brand p { color: rgba(255,255,255,.8); font-size: 13.5px; line-height: 1.65; max-width: 390px; margin: 0; }
.login-features { list-style: none; padding: 0; margin: 22px 0 0; display: flex; flex-direction: column; gap: 9px; font-size: 12.5px; color: rgba(255,255,255,.9); }
.login-features li::before { content: "✓"; color: #C8A24A; font-weight: 800; margin-right: 8px; }
.login-brand-foot { font-size: 11px; color: rgba(255,255,255,.55); position: relative; z-index: 1; }
.login-panel { padding: 48px 44px; display: flex; flex-direction: column; justify-content: center; }
.login-panel-badge {
  align-self: flex-start; background: #E4EFF8; color: #0F4C81; border: 1px solid #C9D9E8;
  border-radius: 999px; padding: 5px 11px; font-size: 10.5px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .6px; margin-bottom: 16px;
}
.login-panel h2 { font-size: 24px; margin: 0 0 6px; color: #1F2937; }
.login-sub { color: #7B8494; font-size: 13px; margin: 0 0 20px; }
.login-panel input {
  width: 100%; padding: 12px 14px; border: 1.5px solid #DDE5EE; border-radius: 10px;
  margin-bottom: 10px; font: inherit; font-size: 15px; background: #fff; outline: none;
}
.login-panel input:focus { border-color: #0F4C81; box-shadow: 0 0 0 3px rgba(15,76,129,.10); }
.login-panel .consent { display: flex; align-items: flex-start; gap: 8px; font-size: 12px; color: #6B7280; line-height: 1.45; margin: 2px 0 10px; }
.login-panel .consent input { width: 16px; height: 16px; margin-top: 2px; accent-color: #0F4C81; flex: 0 0 auto; }
.login-panel .btn.primary {
  width: 100%; background: linear-gradient(135deg, #0F4C81, #1B6FA8); color: #fff;
  border: none; border-radius: 10px; padding: 12px; font-size: 15px; font-weight: 700; cursor: pointer;
  box-shadow: 0 8px 22px rgba(15,76,129,.22);
}
.login-staff-link { display: block; text-align: center; margin-top: 14px; color: #0F4C81; text-decoration: none; font-size: 12.5px; font-weight: 600; }
.login-staff-link:hover { text-decoration: underline; }
.login-panel .emergency-note { font-size: 11.5px; color: #8A93A3; border-top: 1px solid #EEF0F3; padding-top: 12px; margin: 16px 0 0; line-height: 1.5; }
.site-logo-text { font-size: 11px !important; font-weight: 800; letter-spacing: .5px; color: #0F4C81; }
@media (max-width: 860px) {
  .login-screen { padding: 18px 12px; }
  .login-shell { grid-template-columns: 1fr; border-radius: 18px; }
  .login-brand { padding: 24px 22px; min-height: 190px; gap: 16px; }
  .login-brand h1 { font-size: 28px; }
  .login-brand p { font-size: 12.5px; }
  .login-features, .login-brand-foot { display: none; }
  .login-panel { padding: 28px 22px 26px; }
  .login-panel h2 { font-size: 20px; }
}

.rail-tip { background: #F1F7FC; border-color: #C9D9E8; color: #4B5563; }

/* ===== Clinical bases ===== */
.login-screen { flex-direction: column; gap: 28px; }
.clinical-bases { width: min(1080px, 100%); }
.clinical-head { margin-bottom: 16px; }
.clinical-kicker { color: #C8A24A; font-size: 11px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; margin-bottom: 6px; }
.clinical-head h2 { font-family: Georgia, "Times New Roman", serif; font-size: 26px; margin: 0 0 6px; color: #0A3558; }
.clinical-head p { margin: 0; color: #6B7280; font-size: 13px; line-height: 1.5; }
.clinical-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.clinical-card { background: #fff; border: 1px solid #DDE5EE; border-radius: 14px; padding: 18px; box-shadow: 0 4px 16px rgba(10,53,88,.04); }
.clinical-card h3 { margin: 0 0 5px; font-size: 14px; color: #1F2937; line-height: 1.35; }
.clinical-role { font-size: 12px; color: #1B6FA8; font-weight: 600; margin-bottom: 4px; }
.clinical-addr { font-size: 12px; color: #6B7280; margin-bottom: 6px; }
.clinical-card p { margin: 0; font-size: 12px; color: #7B8494; line-height: 1.5; }
.clinical-main { grid-column: span 2; border-left: 4px solid #C8A24A; background: linear-gradient(135deg, #fff, #F7FAFD); }
.clinical-tag { display: inline-block; background: #0F4C81; color: #fff; border-radius: 999px; padding: 4px 9px; font-size: 10px; font-weight: 800; letter-spacing: .4px; text-transform: uppercase; margin-bottom: 8px; }
.clinical-main h3 { font-size: 18px; color: #0A3558; }
.clinical-main .clinical-addr { font-weight: 600; color: #0F4C81; }
.rail-base-name { font-size: 13px; font-weight: 700; color: #1F2937; line-height: 1.4; }
.rail-base-addr { font-size: 12px; color: #7B8494; margin-top: 3px; }
.rail-base-more { font-size: 11px; color: #9AA1AD; line-height: 1.5; margin-top: 8px; border-top: 1px solid #EEF0F3; padding-top: 8px; }
@media (max-width: 860px) {
  .clinical-grid { grid-template-columns: 1fr; }
  .clinical-main { grid-column: auto; }
  .clinical-head h2 { font-size: 22px; }
}



/* auth modes */
.auth-tabs { display: flex; gap: 4px; background: #F1F7FC; border-radius: 10px; padding: 4px; margin-bottom: 14px; }
.auth-tab { flex: 1; border: none; background: transparent; color: #6B7280; border-radius: 8px; padding: 8px 6px; font: inherit; font-size: 11.5px; font-weight: 700; cursor: pointer; }
.auth-tab.active { background: #fff; color: #0F4C81; box-shadow: 0 2px 8px rgba(15,76,129,.10); }
.auth-status { border-radius: 10px; padding: 10px 12px; font-size: 12px; line-height: 1.45; margin-bottom: 12px; background: #FFF8E6; border: 1px solid #F1D9A6; color: #6B4E16; }
.auth-status.ok { background: #EAF7F0; border-color: #B7E4CD; color: #166534; }
.auth-status.err { background: #FDECEC; border-color: #F3C2C2; color: #9B1C1C; }
