:root {
  --bg: #000;
  --panel: #070809;
  --panel-2: #0d0f11;
  --surface: rgba(18, 20, 23, .88);
  --surface-2: rgba(25, 27, 31, .92);
  --line: rgba(255,255,255,.10);
  --line-strong: rgba(255,255,255,.17);
  --text: #f5f6f7;
  --muted: #8b9198;
  --muted-2: #676d74;
  --accent: #91bbff;
  --accent-2: #d4e5ff;
  --danger: #ff8f8f;
  --sidebar-width: 282px;
  --radius-lg: 24px;
  --radius-md: 16px;
  --shadow: 0 30px 80px rgba(0,0,0,.55);
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; background: #000; }
body {
  overflow: hidden;
  color: var(--text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, textarea, input { font: inherit; }
button { color: inherit; }
svg { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.app-shell { display: flex; width: 100%; height: 100dvh; background: #000; }

.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  height: 100%;
  padding: 18px 14px 14px;
  background:
    linear-gradient(180deg, rgba(14,16,18,.98), rgba(7,8,9,.98)),
    #08090a;
  border-right: 1px solid rgba(255,255,255,.07);
  display: flex;
  flex-direction: column;
  transition: width .22s ease, min-width .22s ease, transform .22s ease;
  z-index: 30;
}
.sidebar.collapsed { width: 0; min-width: 0; padding-left: 0; padding-right: 0; overflow: hidden; }

.sidebar-top { height: 46px; display: flex; align-items: center; gap: 8px; }
.brand-button {
  appearance: none; border: 0; background: transparent; padding: 7px 8px; display: flex; align-items: center;
  cursor: pointer; min-width: 0; color: #fff;
}
.brand-button img { width: 148px; height: 31px; object-fit: contain; object-position: left center; display: block; opacity: .96; }
.brand-cx { margin-left: 3px; font-size: 18px; letter-spacing: .08em; font-weight: 300; color: #b4b8bd; }

.icon-button {
  width: 36px; height: 36px; padding: 8px; display: grid; place-items: center;
  border: 0; background: transparent; border-radius: 10px; cursor: pointer; color: #989ea5;
}
.icon-button:hover { background: rgba(255,255,255,.06); color: #fff; }
.collapse-button { margin-left: auto; }
.icon-button svg { width: 20px; height: 20px; }

.new-chat-button {
  width: 100%; height: 44px; margin-top: 11px; padding: 0 14px; border-radius: 13px;
  border: 1px solid rgba(145,187,255,.25);
  background: linear-gradient(180deg, rgba(32,37,43,.96), rgba(23,27,31,.96));
  display: flex; align-items: center; gap: 12px; cursor: pointer; color: #f6f8fa;
}
.new-chat-button:hover { border-color: rgba(145,187,255,.44); background: #1a1e22; }
.new-chat-button svg { width: 19px; height: 19px; }

.side-nav { margin-top: 11px; display: grid; gap: 2px; }
.side-nav-item {
  appearance: none; width: 100%; height: 40px; border: 0; background: transparent; border-radius: 10px;
  display: flex; align-items: center; gap: 12px; padding: 0 12px; color: #c3c7cc; cursor: pointer; text-align: left;
}
.side-nav-item:hover { background: rgba(255,255,255,.055); color: #fff; }
.side-nav-item svg { width: 18px; height: 18px; color: #b8bec5; }
.side-nav-item span { font-size: 13px; }

.sidebar-divider { height: 1px; background: var(--line); margin: 12px 8px; }
.recent-title { padding: 2px 10px 8px; color: #8e949b; font-size: 12px; }
.recent-list { display: grid; gap: 2px; overflow: auto; scrollbar-width: none; }
.recent-list::-webkit-scrollbar { display: none; }
.recent-chat {
  border: 0; background: transparent; color: #babfc5; border-radius: 10px; min-height: 42px; padding: 8px 10px;
  display: grid; grid-template-columns: 18px minmax(0,1fr); gap: 10px; cursor: pointer; text-align: left;
}
.recent-chat:hover { background: rgba(255,255,255,.05); color: #fff; }
.recent-chat svg { width: 17px; height: 17px; margin-top: 1px; }
.recent-chat strong { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 12.5px; font-weight: 450; }
.recent-chat small { color: #6f757c; font-size: 10.5px; }

.sidebar-spacer { flex: 1; min-height: 16px; }
.sidebar-bottom { display: grid; gap: 2px; }

.physician-card {
  margin-top: 6px; padding: 10px 8px; display: flex; align-items: center; gap: 10px; border-radius: 12px;
  border: 1px solid transparent; cursor: pointer;
}
.physician-card:hover { background: rgba(255,255,255,.045); border-color: rgba(255,255,255,.06); }
.physician-avatar {
  width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%;
  background: #1e2226; border: 1px solid rgba(255,255,255,.08); font-size: 11px;
}
.physician-copy { min-width: 0; flex: 1; }
.physician-name { font-size: 12px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.physician-meta { margin-top: 2px; color: #737980; font-size: 9.5px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.physician-arrow { width: 16px; height: 16px; color: #71777e; }

.main { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; background: #000; }
.topbar {
  height: 58px; min-height: 58px; padding: 0 22px; display: flex; align-items: center;
  border-bottom: 1px solid rgba(255,255,255,.055); background: rgba(0,0,0,.88); backdrop-filter: blur(14px);
  z-index: 20;
}
.mobile-menu { display: none; }
.topbar-title { display: flex; align-items: center; gap: 9px; font-size: 12px; color: #a9afb5; letter-spacing: .08em; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #6d747b; box-shadow: 0 0 0 3px rgba(109,116,123,.10); }
.status-dot.online { background: #a7c8ff; box-shadow: 0 0 14px rgba(145,187,255,.7); }
.topbar-badge { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.topbar-badge svg { width: 34px; height: 20px; color: #a9ceff; }
.topbar-badge div { display: grid; gap: 2px; }
.topbar-badge strong { font-size: 11px; font-weight: 520; color: #d9dde1; }
.topbar-badge span { font-size: 9px; color: #6f757c; }

.workspace { position: relative; flex: 1; min-height: 0; overflow: hidden; background: #000; }
.watermark {
  position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; user-select: none;
  opacity: .09; overflow: hidden;
}
.watermark img { position: absolute; width: min(58vw, 760px); max-height: 72vh; object-fit: contain; opacity: .9; filter: brightness(1.18) contrast(1.08); }

.empty-state {
  position: absolute; inset: 0 0 150px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px; z-index: 2; transition: opacity .18s ease, transform .18s ease;
}
.empty-state.hidden { opacity: 0; pointer-events: none; transform: translateY(-8px); }
.hero-brand { display: flex; align-items: baseline; gap: 10px; font-size: clamp(38px, 5vw, 66px); letter-spacing: .2em; font-weight: 280; }
.hero-brand em { font-style: normal; color: var(--accent); font-weight: 260; letter-spacing: .08em; }
.hero-subtitle { margin-top: 13px; font-size: 10px; letter-spacing: .52em; color: #777d84; }
.hero-intro { max-width: 680px; margin-top: 30px; text-align: center; color: #9ca2a8; font-size: 15px; line-height: 1.6; }

.capability-row {
  margin-top: 30px; width: min(850px, 90%); display: grid; grid-template-columns: repeat(4,1fr); gap: 10px;
}
.capability {
  height: 86px; border: 1px solid rgba(255,255,255,.08); border-radius: 16px;
  background: linear-gradient(180deg, rgba(19,21,24,.68), rgba(10,11,13,.48));
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 9px;
  color: #8e949a;
}
.capability svg { width: 23px; height: 23px; color: #cfd4da; }
.capability span { font-size: 10.5px; text-align: center; }

.conversation {
  position: absolute; inset: 0 0 132px; padding: 26px max(26px, calc((100% - 860px)/2));
  overflow-y: auto; scroll-behavior: smooth; z-index: 3;
  scrollbar-color: #26292d transparent; scrollbar-width: thin;
}
.message { width: 100%; margin: 0 auto 24px; display: grid; gap: 8px; animation: messageIn .18s ease; }
@keyframes messageIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
.message-role { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: #666d74; }
.message.user .message-role { text-align: right; }
.message-body { color: #e7eaed; font-size: 14px; line-height: 1.75; white-space: pre-wrap; }
.message.user .message-body {
  margin-left: auto; width: fit-content; max-width: 78%; padding: 12px 15px; border-radius: 18px 18px 5px 18px;
  background: #17191c; border: 1px solid rgba(255,255,255,.075);
}
.message.assistant .message-body { max-width: 820px; color: #d5d9dd; }
.message.system .message-body {
  padding: 11px 13px; border-radius: 12px; border: 1px solid rgba(145,187,255,.16);
  background: rgba(145,187,255,.045); color: #aeb8c4; font-size: 12px;
}
.message-files { margin-left: auto; max-width: 78%; display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.message-file { border: 1px solid rgba(255,255,255,.08); background: #101214; color: #9ca2a8; border-radius: 9px; padding: 6px 9px; font-size: 10px; }

.composer-zone {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); width: min(920px, calc(100% - 38px));
  z-index: 10;
}
.attachment-tray { display: none; flex-wrap: wrap; gap: 7px; margin: 0 12px 8px; }
.attachment-tray.visible { display: flex; }
.attachment-chip {
  height: 35px; max-width: 240px; display: flex; align-items: center; gap: 8px; padding: 0 8px 0 10px;
  background: rgba(20,23,26,.96); border: 1px solid rgba(255,255,255,.11); border-radius: 11px; box-shadow: var(--shadow);
}
.attachment-chip .kind { color: #8eb8f8; font-size: 9px; text-transform: uppercase; letter-spacing: .09em; }
.attachment-chip .filename { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: #c7ccd1; font-size: 10px; }
.attachment-chip button { width: 20px; height: 20px; border: 0; background: transparent; color: #777d84; cursor: pointer; font-size: 17px; line-height: 1; }

.composer {
  min-height: 64px; padding: 8px 10px; border-radius: 24px;
  background: linear-gradient(180deg, rgba(20,22,25,.98), rgba(13,15,17,.98));
  border: 1px solid rgba(255,255,255,.15);
  box-shadow: 0 18px 70px rgba(0,0,0,.62), 0 0 0 1px rgba(0,0,0,.4) inset;
  display: flex; align-items: flex-end; gap: 9px;
}
.composer:focus-within { border-color: rgba(145,187,255,.3); box-shadow: 0 18px 70px rgba(0,0,0,.62), 0 0 32px rgba(145,187,255,.05); }
.add-button, .send-button {
  flex: 0 0 auto; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; cursor: pointer;
}
.add-button { background: #15191d; border: 1px solid rgba(145,187,255,.3); color: #b9d3fb; }
.add-button:hover, .add-button.active { background: #1d242c; border-color: rgba(145,187,255,.6); box-shadow: 0 0 20px rgba(145,187,255,.12); }
.add-button svg, .send-button svg { width: 22px; height: 22px; }
.add-button.active svg { transform: rotate(45deg); transition: transform .16s ease; }

.send-button { background: #d9dde1; border: 0; color: #090a0b; }
.send-button:disabled { opacity: .28; cursor: default; }
.send-button:not(:disabled):hover { background: #fff; }
textarea {
  flex: 1; min-width: 0; max-height: 180px; resize: none; border: 0; outline: 0; background: transparent;
  color: #eef0f2; padding: 11px 5px 8px; line-height: 1.45; font-size: 14px; overflow-y: auto;
}
textarea::placeholder { color: #646a71; }

.composer-footnote { padding-top: 7px; text-align: center; font-size: 9px; color: #51575e; }

.upload-menu {
  position: absolute; left: 6px; bottom: 84px; width: 345px; padding: 7px;
  border-radius: 17px; border: 1px solid rgba(255,255,255,.16);
  background: rgba(20,22,25,.98); box-shadow: 0 24px 65px rgba(0,0,0,.72);
  backdrop-filter: blur(18px);
  opacity: 0; transform: translateY(7px) scale(.98); transform-origin: bottom left; pointer-events: none;
  transition: opacity .14s ease, transform .14s ease;
}
.upload-menu.open { opacity: 1; transform: none; pointer-events: auto; }
.upload-menu button {
  width: 100%; min-height: 52px; padding: 7px 9px; border: 0; background: transparent; border-radius: 11px;
  color: #e3e6e9; display: grid; grid-template-columns: 34px 1fr; gap: 8px; align-items: center; cursor: pointer; text-align: left;
}
.upload-menu button:hover { background: rgba(255,255,255,.055); }
.upload-icon { width: 32px; height: 32px; display: grid; place-items: center; color: #aeb5bd; }
.upload-icon svg { width: 19px; height: 19px; }
.upload-menu strong { display: block; font-size: 12px; font-weight: 500; }
.upload-menu small { display: block; margin-top: 2px; color: #6f757c; font-size: 9.5px; }

.drop-overlay {
  position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.9); backdrop-filter: blur(12px);
  display: grid; place-items: center; opacity: 0; pointer-events: none; transition: opacity .15s ease;
}
.drop-overlay.visible { opacity: 1; pointer-events: auto; }
.drop-overlay div {
  width: min(520px, calc(100% - 36px)); aspect-ratio: 1.7; border: 1px dashed rgba(145,187,255,.48);
  border-radius: 24px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 13px;
  background: rgba(145,187,255,.035);
}
.drop-overlay img { width: 76px; filter: brightness(0) invert(1); opacity: .42; }
.drop-overlay strong { font-size: 17px; font-weight: 450; }
.drop-overlay span { color: #747b82; font-size: 11px; letter-spacing: .15em; }

@media (max-width: 920px) {
  .sidebar { position: fixed; inset: 0 auto 0 0; transform: translateX(-100%); box-shadow: 30px 0 70px rgba(0,0,0,.6); }
  .sidebar.mobile-open { transform: translateX(0); }
  .sidebar.collapsed { width: var(--sidebar-width); min-width: var(--sidebar-width); padding: 18px 14px 14px; }
  .mobile-menu { display: grid; margin-right: 8px; }
  .capability-row { grid-template-columns: repeat(2,1fr); width: min(580px, 92%); }
  .topbar-badge span { display: none; }
  .topbar-badge strong { display: none; }
  .composer-zone { width: calc(100% - 22px); bottom: 10px; }
  .conversation { inset-bottom: 122px; padding-left: 18px; padding-right: 18px; }
}

@media (max-width: 600px) {
  .topbar { padding: 0 11px; }
  .topbar-badge { display: none; }
  .hero-brand { font-size: 37px; gap: 5px; }
  .hero-subtitle { font-size: 8px; letter-spacing: .28em; text-align: center; }
  .hero-intro { font-size: 13px; margin-top: 22px; }
  .capability-row { grid-template-columns: repeat(2,1fr); gap: 7px; }
  .capability { height: 74px; }
  .upload-menu { width: calc(100vw - 26px); left: 0; }
  .message.user .message-body, .message-files { max-width: 90%; }
  .composer { min-height: 58px; border-radius: 20px; }
  .add-button, .send-button { width: 40px; height: 40px; }
}


.login-overlay {
  position: fixed; inset: 0; z-index: 200;
  display: grid; place-items: center;
  background: #000;
  opacity: 1; pointer-events: auto;
  transition: opacity .2s ease;
}
.login-overlay.hidden { opacity: 0; pointer-events: none; }
.login-card {
  width: min(420px, calc(100vw - 32px));
  padding: 34px 30px 28px;
  border: 1px solid rgba(210,218,228,.18);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(18,20,24,.98), rgba(8,10,12,.98));
  box-shadow: 0 40px 100px rgba(0,0,0,.78), 0 0 0 1px rgba(196,206,218,.06) inset;
}
.login-logo {
  display: block;
  width: 210px;
  max-height: 132px;
  object-fit: contain;
  margin: 0 auto 14px;
  filter: drop-shadow(0 8px 24px rgba(215,225,235,.10));
}
.login-product {
  text-align: center;
  font-size: 23px;
  letter-spacing: .14em;
  color: #f0f4f8;
  text-shadow: 0 0 14px rgba(210,220,235,.12);
  font-weight: 330;
}
.login-product span { color: #dfe7f2; font-weight: 300; }
.login-subtitle {
  margin: 7px 0 28px;
  text-align: center;
  color: #a5adb7;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .22em;
}
.login-card form { display: grid; gap: 14px; }
.login-card label { display: grid; gap: 7px; }
.login-card label span {
  color: #c4cbd4;
  font-size: 10px;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.login-card input {
  width: 100%;
  height: 46px;
  padding: 0 13px;
  outline: 0;
  border-radius: 12px;
  border: 1px solid rgba(210,218,228,.18);
  background: #0b0d0f;
  color: #eef1f3;
}
.login-card input:focus { border-color: rgba(203,214,229,.42); box-shadow: 0 0 0 3px rgba(202,214,230,.08); }
.login-card button[type="submit"] {
  height: 46px;
  margin-top: 4px;
  border: 1px solid rgba(145,187,255,.28);
  border-radius: 12px;
  background: linear-gradient(180deg, #eef2f5, #d5dbe2);
  color: #090a0b;
  box-shadow: 0 6px 18px rgba(213,219,226,.10);
  cursor: pointer;
  font-weight: 600;
}
.login-card button[type="submit"]:disabled { opacity: .5; cursor: wait; }
.login-error {
  min-height: 17px;
  margin-top: 12px;
  text-align: center;
  color: #ff9c9c;
  font-size: 11px;
}
.login-footnote {
  margin-top: 15px;
  text-align: center;
  color: #8d97a2;
  font-size: 9px;
}

.login-card button[type="submit"]:hover { background: linear-gradient(180deg, #f7fafc, #dde3e9); }
.login-card input::placeholder { color: #8d96a0; }


.hero-brand-stacked {
  display:flex;
  flex-direction:column;
  gap:10px;
  align-items:center;
  text-align:center;
}
.hero-brand-stacked span {
  font-size: clamp(18px, 2.1vw, 28px);
  letter-spacing: 0.08em;
  line-height: 1.25;
}
.hero-brand-stacked em {
  font-style: normal;
  font-size: clamp(16px, 1.8vw, 22px);
  letter-spacing: 0.32em;
}
.login-product-stacked {
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:8px;
  text-align:center;
  max-width: 420px;
  margin-inline:auto;
}
.login-product-stacked span {
  font-size: clamp(18px, 2vw, 26px);
  letter-spacing: 0.09em;
  line-height: 1.35;
}
.login-product-stacked strong {
  font-size: clamp(17px, 1.8vw, 24px);
  letter-spacing: 0.34em;
  font-weight: 600;
  color: var(--text-primary);
}


.message-body h2,.message-body h3,.message-body h4 { margin: 16px 0 8px; color:#f2f5f7; line-height:1.35; }
.message-body h2 { font-size:16px; font-weight:650; }
.message-body h3 { font-size:14.5px; font-weight:620; }
.message-body h4 { font-size:13.5px; font-weight:600; }
.message-body p { margin:0 0 10px; }
.message-body ul,.message-body ol { margin:6px 0 12px 22px; padding:0; }
.message-body li { margin:5px 0; }
.message-body strong { color:#f4f6f8; font-weight:650; }
.message-body code { padding:2px 5px; border-radius:5px; background:#12161a; border:1px solid rgba(255,255,255,.08); font-size:.92em; }
.message-body a { color:#a8cfff; text-decoration:none; border-bottom:1px solid rgba(168,207,255,.25); }
.message-body a:hover { border-bottom-color:rgba(168,207,255,.75); }

.settings-overlay { position:fixed; inset:0; z-index:250; display:grid; place-items:center; background:rgba(0,0,0,.72); backdrop-filter:blur(10px); opacity:0; pointer-events:none; transition:.16s ease; }
.settings-overlay.open { opacity:1; pointer-events:auto; }
.settings-panel { width:min(520px,calc(100vw - 30px)); border:1px solid rgba(205,214,226,.16); border-radius:22px; background:linear-gradient(180deg,#12151a,#090b0e); box-shadow:0 35px 100px rgba(0,0,0,.72); padding:24px; }
.settings-head { display:flex; gap:16px; align-items:flex-start; justify-content:space-between; }
.settings-kicker { color:#89939e; font-size:9px; letter-spacing:.18em; text-transform:uppercase; }
.settings-head h2 { margin:5px 0 0; font-size:20px; font-weight:560; }
.settings-close { width:36px; height:36px; border-radius:50%; border:1px solid rgba(255,255,255,.1); background:#15181c; color:#cfd4da; font-size:21px; cursor:pointer; }
.settings-grid { margin-top:22px; border:1px solid rgba(255,255,255,.07); border-radius:14px; overflow:hidden; }
.settings-row { display:flex; justify-content:space-between; gap:20px; padding:12px 14px; border-bottom:1px solid rgba(255,255,255,.06); }
.settings-row:last-child { border-bottom:0; }
.settings-row span { color:#7f8790; font-size:11px; }
.settings-row strong { color:#e4e8ec; font-size:11px; font-weight:520; text-align:right; }
.settings-note { margin-top:16px; color:#79818a; font-size:10px; line-height:1.65; }
.settings-logout { width:100%; margin-top:18px; height:44px; border-radius:12px; border:1px solid rgba(255,255,255,.12); background:#181b20; color:#e6e9ec; cursor:pointer; }
.settings-logout:hover { background:#20242a; }
.recent-chat.active { background:rgba(145,187,255,.075); border-color:rgba(145,187,255,.16); }


/* v0.8: desktop sidebar collapse/expand recovery */
.sidebar-expand-button {
  display: none;
  margin-right: 8px;
  flex: 0 0 auto;
}
body.sidebar-is-collapsed .sidebar-expand-button {
  display: grid;
}
body.sidebar-is-collapsed .main {
  min-width: 0;
}
@media (max-width: 920px) {
  .sidebar-expand-button { display: none !important; }
}


/* v0.9 safe-markdown rendering */
.message.assistant .message-body {
  white-space: normal;
  font-weight: 400;
}
.message.assistant .message-body p {
  font-weight: 400;
}
.message.assistant .message-body h2,
.message.assistant .message-body h3 {
  letter-spacing: .01em;
}


/* v0.12 — evidence links + multimodal attachment presentation */
.message-body em {
  color: #e7eaed;
  font-style: italic;
}
.message-body a {
  overflow-wrap: anywhere;
}
.message-body a::after {
  content: "↗";
  margin-left: 3px;
  font-size: .78em;
  opacity: .56;
}
.message-files {
  align-items: flex-start;
}
.message-image-card {
  width: min(420px, 78vw);
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 14px;
  background: #0d0f11;
  color: #d8dde2;
  cursor: zoom-in;
  text-align: left;
  box-shadow: 0 12px 35px rgba(0,0,0,.28);
}
.message-image-card:hover {
  border-color: rgba(145,187,255,.36);
}
.message-image-card img {
  display: block;
  width: 100%;
  max-height: 360px;
  object-fit: contain;
  background: #050607;
}
.message-attachment-meta {
  display: grid;
  gap: 2px;
  padding: 9px 11px 10px;
}
.message-attachment-meta strong {
  color: #9fc5ff;
  font-size: 9px;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-weight: 600;
}
.message-attachment-meta span {
  min-width: 0;
  color: #b9c0c7;
  font-size: 10.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.message-document-card {
  min-width: 250px;
  max-width: 420px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,.11);
  border-radius: 12px;
  background: #0d0f11;
}
.message-document-icon {
  flex: 0 0 auto;
  min-width: 40px;
  height: 40px;
  padding: 0 6px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: rgba(145,187,255,.09);
  border: 1px solid rgba(145,187,255,.17);
  color: #a8cfff;
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: .08em;
}
.message-document-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}
.message-document-copy strong {
  color: #d8dde2;
  font-size: 10.5px;
  font-weight: 520;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.message-document-copy small {
  color: #747c84;
  font-size: 9px;
  line-height: 1.35;
}
.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(0,0,0,.92);
  backdrop-filter: blur(12px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .14s ease;
}
.image-lightbox.open {
  opacity: 1;
  pointer-events: auto;
}
.image-lightbox-panel {
  position: relative;
  width: min(1180px, 96vw);
  height: min(88vh, 900px);
  display: grid;
  grid-template-rows: minmax(0,1fr) auto;
  background: #050607;
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 35px 100px rgba(0,0,0,.75);
}
.image-lightbox-panel img {
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
  background: #000;
}
.image-lightbox-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(15,17,20,.88);
  color: #eef1f4;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}
.image-lightbox-caption {
  padding: 10px 14px;
  border-top: 1px solid rgba(255,255,255,.08);
  color: #9ca4ac;
  font-size: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (max-width: 640px) {
  .message-image-card { width: min(100%, 78vw); }
  .image-lightbox { padding: 8px; }
  .image-lightbox-panel { width: 100%; height: 92vh; border-radius: 12px; }
}


/* v0.13 — patient-centric clinical workspace + mobile hardening */
.watermark { opacity: .12; }
.watermark img { opacity: .96; filter: brightness(1.22) contrast(1.10); }

.mobile-sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 305;
  background: rgba(0,0,0,.58);
  backdrop-filter: blur(3px);
}
.mobile-sidebar-backdrop.visible { display: block; }

.active-patient-topbar {
  margin-left: auto;
  margin-right: 14px;
  min-width: 0;
  max-width: 300px;
  height: 34px;
  padding: 0 11px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid rgba(145,187,255,.18);
  border-radius: 999px;
  background: rgba(145,187,255,.055);
  color: #c6d9f3;
  cursor: pointer;
}
.active-patient-topbar span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 9.5px;
}
.active-patient-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #9bc6ff;
  box-shadow: 0 0 12px rgba(155,198,255,.6);
}

.patient-context-bar {
  margin: 0 6px 8px;
  min-height: 48px;
  padding: 7px 9px 7px 11px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(145,187,255,.18);
  border-radius: 13px;
  background: linear-gradient(180deg, rgba(21,28,36,.96), rgba(12,16,21,.96));
  box-shadow: 0 8px 24px rgba(0,0,0,.24);
}
.patient-context-copy {
  min-width: 0;
  flex: 1;
  display: grid;
  gap: 1px;
}
.patient-context-kicker {
  color: #84b9fb;
  font-size: 7.5px;
  letter-spacing: .16em;
}
.patient-context-copy strong {
  color: #e4ebf2;
  font-size: 11px;
  font-weight: 560;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.patient-context-copy small {
  color: #747f8b;
  font-size: 8.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.patient-case-select {
  max-width: 210px;
  height: 30px;
  padding: 0 28px 0 9px;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 9px;
  background: #101419;
  color: #9da7b1;
  font-size: 9px;
  outline: none;
}
.patient-context-action {
  height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(145,187,255,.24);
  border-radius: 9px;
  background: rgba(145,187,255,.07);
  color: #a9cfff;
  font-size: 8.5px;
  cursor: pointer;
}
.patient-context-action.muted {
  border-color: rgba(255,255,255,.08);
  background: #111417;
  color: #777f87;
}

.a1-mode-button {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  border: 1px solid rgba(205,214,226,.15);
  border-radius: 12px;
  background: #12161a;
  color: #8c959e;
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  transition: .15s ease;
}
.a1-mode-button:hover {
  color: #c8d9ec;
  border-color: rgba(145,187,255,.32);
}
.a1-mode-button.active {
  color: #d7e9ff;
  border-color: rgba(145,187,255,.58);
  background: linear-gradient(180deg, rgba(32,49,68,.96), rgba(17,28,39,.96));
  box-shadow: 0 0 22px rgba(145,187,255,.12);
}

.patient-search-overlay {
  position: fixed;
  inset: 0;
  z-index: 420;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0,0,0,.80);
  backdrop-filter: blur(12px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s ease;
}
.patient-search-overlay.open {
  opacity: 1;
  pointer-events: auto;
}
.patient-search-panel {
  width: min(720px, calc(100vw - 26px));
  max-height: min(760px, calc(100vh - 34px));
  overflow: auto;
  padding: 23px;
  border: 1px solid rgba(205,214,226,.15);
  border-radius: 22px;
  background: linear-gradient(180deg, #11151a, #080a0d);
  box-shadow: 0 35px 100px rgba(0,0,0,.76);
}
.patient-search-head {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  justify-content: space-between;
}
.patient-search-head h2 {
  margin: 4px 0 6px;
  color: #eef1f4;
  font-size: 24px;
  font-weight: 430;
}
.patient-search-head p {
  margin: 0;
  color: #78818a;
  font-size: 10px;
  line-height: 1.5;
}
.patient-search-box {
  margin-top: 19px;
  height: 48px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 8px 0 13px;
  border: 1px solid rgba(145,187,255,.19);
  border-radius: 13px;
  background: #0d1115;
}
.patient-search-box svg {
  width: 18px;
  height: 18px;
  color: #718091;
}
.patient-search-box input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: #e4e8ed;
  font-size: 12px;
}
.patient-search-box button {
  height: 34px;
  padding: 0 14px;
  border: 1px solid rgba(145,187,255,.24);
  border-radius: 9px;
  background: rgba(145,187,255,.08);
  color: #b9d6fb;
  cursor: pointer;
  font-size: 9px;
}
.patient-search-status {
  min-height: 25px;
  padding: 10px 2px 4px;
  color: #747e88;
  font-size: 9px;
}
.patient-search-results {
  display: grid;
  gap: 7px;
}
.patient-result-card {
  position: relative;
  width: 100%;
  min-height: 58px;
  padding: 10px 44px 10px 13px;
  display: grid;
  gap: 4px;
  text-align: left;
  border: 1px solid rgba(255,255,255,.075);
  border-radius: 12px;
  background: rgba(255,255,255,.022);
  color: #d8dde3;
  cursor: pointer;
}
.patient-result-card:hover {
  border-color: rgba(145,187,255,.25);
  background: rgba(145,187,255,.045);
}
.patient-result-card strong {
  font-size: 11px;
  font-weight: 540;
}
.patient-result-card span {
  color: #77818a;
  font-size: 8.7px;
}
.patient-result-arrow {
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: #8fbdf6 !important;
  font-size: 17px !important;
}
.patient-search-footnote {
  margin-top: 17px;
  padding-top: 13px;
  border-top: 1px solid rgba(255,255,255,.06);
  color: #626b74;
  font-size: 8.5px;
  line-height: 1.5;
}

@media (max-width: 920px) {
  .sidebar {
    z-index: 320;
    width: min(84vw, 320px);
    min-width: min(84vw, 320px);
    transition: transform .16s ease;
  }
  .sidebar.mobile-open {
    transform: translateX(0);
  }
  .mobile-menu {
    position: relative;
    z-index: 330;
    display: grid !important;
    width: 44px;
    height: 44px;
    min-width: 44px;
    margin-right: 5px;
    padding: 0;
    place-items: center;
    pointer-events: auto;
    touch-action: manipulation;
  }
  .mobile-menu svg { width: 22px; height: 22px; }
  .topbar { position: relative; z-index: 300; }
  .active-patient-topbar {
    margin-left: auto;
    margin-right: 2px;
    max-width: 145px;
    height: 32px;
  }
  .patient-context-bar {
    flex-wrap: wrap;
    gap: 7px;
  }
  .patient-context-copy {
    flex-basis: calc(100% - 150px);
  }
  .patient-case-select {
    order: 5;
    max-width: none;
    width: 100%;
  }
}

@media (max-width: 600px) {
  .watermark { opacity: .105; }
  .watermark img { width: 82vw; }
  .patient-search-overlay { padding: 8px; }
  .patient-search-panel {
    width: 100%;
    max-height: 94vh;
    padding: 17px;
    border-radius: 16px;
  }
  .active-patient-topbar {
    max-width: 118px;
  }
  .topbar-title {
    min-width: 0;
    flex: 1;
  }
  .topbar-title span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .a1-mode-button {
    width: 36px;
    height: 36px;
    border-radius: 10px;
  }
}


/* v0.14.1A — protected companion UX; core app.js remains v0.13 */
.watermark img {
  transform: translateY(-3vh);
}

.cx141-processing {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(100% + 10px);
  width: min(900px, calc(100vw - 340px));
  min-height: 28px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 9px;
  color: #8f99a4;
  font-size: 11px;
  letter-spacing: .015em;
  pointer-events: none;
}

.cx141-processing[hidden] {
  display: none !important;
}

.cx141-thinking-dots {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  min-width: 28px;
}

.cx141-thinking-dots i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #a7c8ff;
  opacity: .28;
  animation: cx141Thinking 1.15s infinite ease-in-out;
}

.cx141-thinking-dots i:nth-child(2) { animation-delay: .16s; }
.cx141-thinking-dots i:nth-child(3) { animation-delay: .32s; }

@keyframes cx141Thinking {
  0%, 80%, 100% { opacity: .24; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}

@media (max-width: 920px) {
  .watermark img { transform: translateY(-2vh); }
  .cx141-processing {
    width: calc(100vw - 34px);
    font-size: 10.5px;
  }
}
