/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

:root {
  --ink: #0A0B0D;
  --ink-2: #1A1C20;
  --paper: #FAFAF7;
  --paper-2: #F2F2EE;
  --blue: #1E6FD9;
  --blue-deep: #134FA0;
  --blue-ghost: #E8F0FC;
  --signal: #C83C2A;
  --success: #1FA971;
  --muted: #5A616B;
  --muted-2: #8A909A;
  --line: #E3E5E9;
  --line-2: #EEEFF2;
  --white: #FFFFFF;
  --font-sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-tight: "Inter Tight", Inter, ui-sans-serif, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
}

* {
  box-sizing: border-box;
}

.sr-only {
  border: 0;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2 {
  font-family: var(--font-tight);
  letter-spacing: -0.035em;
  line-height: 0.96;
  margin: 0 0 18px;
}

h1 {
  font-size: clamp(44px, 6vw, 88px);
}

h2 {
  font-size: clamp(36px, 4vw, 64px);
}

p {
  color: var(--muted);
  line-height: 1.45;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--white);
  color: var(--ink);
  font: inherit;
  padding: 14px 16px;
}

textarea {
  resize: vertical;
}

pre {
  overflow: auto;
  border: 1px solid var(--line);
  background: var(--paper-2);
  padding: 18px;
}

.section-label {
  color: var(--blue);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  margin-bottom: 14px;
  text-transform: uppercase;
}

.button,
input[type="submit"].button {
  align-items: center;
  background: var(--paper);
  border: 1px solid var(--ink);
  border-radius: 0;
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  justify-content: center;
  letter-spacing: 0.08em;
  padding: 12px 16px;
  text-transform: uppercase;
}

.button--primary,
input[type="submit"].button--primary {
  background: var(--blue);
  border-color: var(--blue);
  color: var(--white);
}

.button--primary:hover {
  background: var(--blue-deep);
}

.flash-stack {
  left: 50%;
  position: fixed;
  top: 18px;
  transform: translateX(-50%);
  width: min(620px, calc(100vw - 32px));
  z-index: 20;
}

.flash-stack--inline {
  left: auto;
  margin-bottom: 18px;
  position: static;
  top: auto;
  transform: none;
  width: auto;
}

.flash {
  border: 1px solid var(--line);
  background: var(--white);
  margin-bottom: 8px;
  padding: 14px 16px;
  transition: opacity 280ms ease, transform 280ms ease;
}

.flash--alert {
  border-color: var(--signal);
  color: var(--signal);
}

.flash--dismissing {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
}

.app-shell,
.admin-shell {
  display: grid;
  min-height: 100vh;
}

.app-shell {
  grid-template-columns: 320px 1fr;
}

.sidebar,
.admin-sidebar {
  background: var(--ink);
  color: var(--paper);
  padding: 28px;
}

.brand {
  align-items: center;
  display: flex;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  gap: 10px;
  letter-spacing: 0.1em;
  margin-bottom: 36px;
  text-transform: uppercase;
}

.brand__mark {
  background: var(--blue);
  display: inline-block;
  height: 12px;
  width: 12px;
}

.sidebar__section,
.patient-list {
  border-top: 1px solid rgba(255,255,255,0.14);
  padding-top: 18px;
}

.patient-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.patient-card,
.conversation-link {
  border: 1px solid var(--line);
  display: flex;
  gap: 12px;
  padding: 14px;
}

.patient-card {
  border-color: rgba(255,255,255,0.14);
}

.patient-card.is-active,
.conversation-link.is-active {
  border-color: var(--blue);
  background: var(--blue-ghost);
  color: var(--ink);
}

.patient-card__initials {
  align-items: center;
  border: 1px solid currentColor;
  display: inline-flex;
  font-family: var(--font-mono);
  height: 36px;
  justify-content: center;
  width: 36px;
}

.patient-card strong,
.conversation-link strong,
.artifact-card strong {
  display: block;
}

.patient-card small,
.conversation-link small,
.artifact-card small {
  color: var(--muted-2);
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  margin-top: 4px;
  text-transform: uppercase;
}

.conversation-panel {
  min-width: 0;
  padding: 32px;
}

.workspace-header {
  align-items: start;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 26px;
}

.header-actions,
.form-actions,
.composer__row {
  align-items: center;
  display: flex;
  gap: 12px;
}

.workspace-grid {
  display: grid;
  gap: 22px;
  grid-template-columns: 260px minmax(0, 1fr);
  padding-top: 24px;
}

.conversation-list,
.admin-card,
.auth-card {
  background: var(--white);
  border: 1px solid var(--line);
  padding: 24px;
}

.conversation-list {
  display: grid;
  gap: 10px;
  align-content: start;
}

.chat {
  min-width: 0;
}

.message-stream {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
}

.message {
  border: 1px solid var(--line);
  background: var(--white);
  padding: 20px;
}

.message--assistant {
  border-left: 4px solid var(--blue);
}

.message--user {
  border-left: 4px solid var(--ink);
}

.message__meta {
  color: var(--muted-2);
  display: flex;
  font-family: var(--font-mono);
  font-size: 11px;
  justify-content: space-between;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
  text-transform: uppercase;
}

.message__body p:last-child {
  margin-bottom: 0;
}

.message__sources {
  border-top: 1px solid var(--line-2);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
  padding-top: 12px;
}

.source-pill {
  background: var(--paper-2);
  border: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 6px 8px;
  text-transform: uppercase;
}

.composer {
  background: var(--ink);
  border: 1px solid var(--ink);
  padding: 18px;
}

.composer textarea:first-child {
  background: var(--paper);
  margin-bottom: 12px;
}

.composer__row textarea {
  min-height: 48px;
}

.context-stat,
.artifact-card,
.metric-card {
  border-top: 1px solid var(--line);
  padding: 18px 0;
}

.context-stat strong,
.metric-card strong {
  color: var(--blue);
  display: block;
  font-family: var(--font-tight);
  font-size: 52px;
  letter-spacing: -0.05em;
  line-height: 0.9;
}

.empty-product,
.empty-state {
  padding: 80px;
}

.auth-shell {
  align-items: center;
  display: grid;
  min-height: 100vh;
  padding: 32px;
  place-items: center;
}

.auth-card {
  width: min(560px, 100%);
}

.auth-card--wide {
  width: min(920px, 100%);
}

.clinical-form {
  display: grid;
  gap: 16px;
}

.clinical-form label {
  color: var(--muted);
  display: grid;
  font-family: var(--font-mono);
  font-size: 12px;
  gap: 8px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.clinical-form small,
.form-errors {
  color: var(--signal);
  font-family: var(--font-sans);
  letter-spacing: 0;
  text-transform: none;
}

.form-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.check-row {
  align-items: center;
  display: flex !important;
  gap: 10px !important;
}

.check-row input {
  width: auto;
}

.admin-shell {
  grid-template-columns: 260px 1fr;
}

.admin-sidebar {
  display: grid;
  align-content: start;
  gap: 12px;
}

.admin-sidebar a,
.admin-sidebar .sidebar-link--button {
  border-top: 1px solid rgba(255,255,255,0.14);
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  padding-top: 12px;
  text-align: left;
  text-transform: uppercase;
}

.admin-content {
  padding: 40px;
}

.metric-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin: 24px 0;
}

.metric-card {
  background: var(--white);
  border: 1px solid var(--line);
  padding: 24px;
}

.metric-card span {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.admin-table {
  border: 1px solid var(--line);
  display: grid;
  margin-top: 18px;
}

.admin-row {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 18px;
  grid-template-columns: 1.4fr 1fr 1fr;
  padding: 14px 16px;
}

.admin-row:last-child {
  border-bottom: 0;
}

@media (max-width: 1100px) {
  .app-shell,
  .admin-shell,
  .workspace-grid {
    grid-template-columns: 1fr;
  }

  .sidebar,
  .admin-sidebar {
    min-height: auto;
  }

  .workspace-header,
  .header-actions,
  .form-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .metric-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }
}

/* Dark imaging workspace: blue-slate throughout (matches composer treatment) */
:root {
  --bg: #080a0f;
  --bg-elev: rgba(8,10,15,0.92);
  --stream: rgba(7,9,13,0.55);
  --surface: rgba(16,20,28,0.92);
  --surface-2: rgba(21,26,36,0.9);
  --surface-3: #1b2230;
  --surface-inset: #151b28;
  --elevated: #202837;
  --text: #f4f7fb;
  --text-soft: #b8c0cc;
  --text-muted: #778292;
  --line-dark: rgba(255,255,255,0.08);
  --line-strong: rgba(255,255,255,0.14);
  --blue-soft: rgba(30,111,217,0.16);
  --blue-ring: rgba(30,111,217,0.38);
  --radius-sm: 5px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 14px;
  /* Composer: darker than panels; blue-slate */
  --composer-surface: #121a28;
  --composer-menu: #0d131f;
  --radius-composer: 20px;
}

body {
  background:
    radial-gradient(circle at 30% -10%, rgba(30,111,217,0.14), transparent 34rem),
    linear-gradient(180deg, #0b0e14 0%, var(--bg) 100%);
  color: var(--text);
}

p {
  color: var(--text-soft);
}

h1 {
  color: var(--text);
  font-size: clamp(34px, 3.4vw, 56px);
  letter-spacing: -0.045em;
}

h2 {
  color: var(--text);
  font-size: clamp(22px, 2vw, 32px);
  letter-spacing: -0.03em;
  margin-bottom: 0;
}

input,
textarea,
select {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line-dark);
  border-radius: var(--radius-sm);
  color: var(--text);
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

input:focus,
textarea:focus,
select:focus {
  background: rgba(255,255,255,0.06);
  border-color: var(--blue-ring);
  box-shadow: 0 0 0 4px rgba(30,111,217,0.12);
}

input::file-selector-button {
  background: var(--surface-3);
  border: 0;
  border-radius: 5px;
  color: var(--text);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 11px;
  margin-right: 12px;
  padding: 8px 10px;
  text-transform: uppercase;
}

pre {
  background: var(--surface-2);
  border-color: var(--line-dark);
  border-radius: var(--radius-md);
  color: var(--text-soft);
}

.section-label {
  color: #7DB1FF;
  font-size: 10px;
  margin-bottom: 8px;
}

.section-heading {
  align-items: end;
  display: flex;
  justify-content: space-between;
  margin-bottom: 14px;
}

.section-heading span,
.patient-meta span,
.status-pill {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.button,
input[type="submit"].button {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--text);
  min-height: 40px;
  padding: 11px 16px;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.button:hover {
  background: rgba(255,255,255,0.09);
  border-color: rgba(255,255,255,0.22);
}

.button--primary,
input[type="submit"].button--primary {
  background: var(--blue);
  border-color: var(--blue);
  color: var(--white);
}

.button--primary:hover {
  background: #2F80ED;
  border-color: #2F80ED;
  transform: translateY(-1px);
}

.flash-stack {
  top: 20px;
}

.flash {
  backdrop-filter: blur(16px);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  box-shadow: 0 16px 50px rgba(0,0,0,0.28);
  color: var(--text);
  transition: opacity 280ms ease, transform 280ms ease;
}

.flash--dismissing {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
}

.app-shell {
  background: transparent;
  gap: 0;
  grid-template-columns: 300px minmax(0, 1fr);
  min-height: 100vh;
}

.app-shell--workspace {
  grid-template-columns: minmax(260px, 300px) minmax(0, 1fr);
}

.sidebar,
.admin-sidebar {
  background: var(--bg-elev);
  border-right: 1px solid var(--line-dark);
  color: var(--text);
  padding: 22px;
}

.sidebar {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  gap: 0;
  min-height: 100vh;
  min-width: 0;
  position: sticky;
  top: 0;
}

.sidebar__top {
  display: grid;
  flex-shrink: 0;
  gap: 14px;
  margin-bottom: 18px;
}

.sidebar__workspace {
  display: flex;
  flex: 1;
  flex-direction: column;
  margin-bottom: 16px;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding-bottom: 4px;
}

.sidebar-active-patient {
  background: var(--surface);
  border: 1px solid var(--line-dark);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
  padding: 14px 14px 12px;
}

.sidebar-active-patient__name {
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  margin: 0 0 4px;
}

.sidebar-active-patient__meta {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  margin: 0 0 12px;
  text-transform: uppercase;
}

.sidebar-active-patient__row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
}

.sidebar-threads {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: 0;
}

.sidebar-threads .section-heading {
  margin-bottom: 10px;
}

.sidebar-threads__list {
  display: flex;
  flex: 0 1 auto;
  flex-direction: column;
  gap: 6px;
  max-height: min(50vh, 28rem);
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0 0 2px 2px;
  scrollbar-gutter: stable;
}

.sidebar-threads__list .conversation-link {
  display: block;
  font-size: 13px;
}

.sidebar-threads form {
  margin: 0;
  width: 100%;
}

.button--tight {
  min-height: 32px;
  padding: 6px 10px;
}

.button--block {
  margin-top: 8px;
  width: 100%;
}

.sidebar-link--inline {
  font-size: 11px;
  margin: 0;
  padding: 0;
  text-transform: none;
  letter-spacing: 0.02em;
}

.patient-modal,
.patient-modal[open] {
  background: transparent;
  border: 0;
  box-shadow: none;
  box-sizing: border-box;
  max-height: 100dvh;
  max-width: 100dvw;
  min-height: 0;
  padding: 0;
  width: 100dvw;
}

.patient-modal::backdrop {
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(2px);
}

.patient-modal__layer {
  align-items: flex-start;
  background: none;
  box-sizing: border-box;
  display: flex;
  justify-content: center;
  min-height: 100dvh;
  padding: max(1.5rem, 4dvh) 1rem 2rem;
  width: 100%;
}

.patient-modal__box {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xl);
  box-shadow: 0 24px 64px rgba(0,0,0,0.4);
  max-width: 440px;
  width: 100%;
}

.patient-modal__head {
  align-items: center;
  border-bottom: 1px solid var(--line-dark);
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 16px 18px 12px;
}

.patient-modal__title {
  color: var(--text);
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0;
}

.patient-modal__hint {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.4;
  margin: 0;
  padding: 10px 18px 0;
}

.patient-modal__list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: min(48dvh, 24rem);
  overflow-x: hidden;
  overflow-y: auto;
  padding: 12px 14px 4px;
}

.patient-row {
  align-items: center;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  color: var(--text-soft);
  display: flex;
  gap: 10px;
  padding: 8px 10px;
  text-decoration: none;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease;
}

.patient-row:hover {
  background: rgba(255,255,255,0.06);
  color: var(--text);
}

.patient-row.is-active {
  background: var(--blue-soft);
  border-color: var(--blue-ring);
  color: var(--text);
}

.patient-row__text {
  display: block;
  min-width: 0;
}

.patient-row__text strong {
  display: block;
  font-size: 13px;
  line-height: 1.3;
  margin: 0;
}

.patient-row__text small {
  color: var(--text-muted);
  display: block;
  font-size: 10px;
  margin-top: 3px;
  text-transform: uppercase;
}

.patient-row.is-active .patient-row__text small {
  color: var(--text-muted);
}

.patient-modal__foot {
  border-top: 1px solid var(--line-dark);
  padding: 14px 18px 18px;
}

.brand {
  color: var(--text);
  margin-bottom: 0;
}

.brand__mark {
  border-radius: 2px;
  box-shadow: 0 0 20px rgba(30,111,217,0.72);
}

.account-card {
  background: var(--surface);
  border: 1px solid var(--line-dark);
  border-radius: var(--radius-md);
  padding: 14px;
}

.account-card strong {
  display: block;
  font-size: 13px;
}

.account-card small {
  color: var(--text-muted);
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  margin-top: 5px;
  text-transform: uppercase;
}

.account-card__actions {
  margin-top: 12px;
}

.sidebar-link {
  color: #7DB1FF;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar-action-form {
  margin: 0;
}

.sidebar-link--button {
  appearance: none;
  background: transparent;
  border: 0;
  cursor: pointer;
  padding: 0;
}

.sidebar__section {
  border-top: 1px solid var(--line-dark);
  flex-shrink: 0;
  padding-top: 16px;
}

.patient-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 0;
}

.patient-card,
.conversation-link {
  background: rgba(255,255,255,0.03);
  border-color: transparent;
  border-radius: var(--radius-md);
  color: var(--text-soft);
  padding: 12px;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.patient-card:hover,
.conversation-link:hover {
  background: rgba(255,255,255,0.06);
  color: var(--text);
}

.patient-card.is-active,
.conversation-link.is-active {
  background: var(--blue-soft);
  border-color: var(--blue-ring);
  color: var(--text);
}

.patient-card__initials {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--text);
  flex: 0 0 auto;
}

.patient-card small,
.conversation-link small,
.artifact-card small {
  color: var(--text-muted);
}

.conversation-panel {
  min-height: 100vh;
  min-width: 0;
  padding: 24px;
}

.conversation-panel--wide {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  padding: 20px 28px 28px;
}

.chat--solo {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}

.chat--solo .message-stream {
  flex: 1 1 auto;
  min-height: 280px;
}

.empty-state--inline {
  margin: 0;
  max-width: 32rem;
  padding: 3rem 2rem;
}

.workspace-header {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line-dark);
  border-radius: var(--radius-xl);
  gap: 24px;
  margin-bottom: 18px;
  padding: 24px;
}

.workspace-header h1 {
  margin-bottom: 10px;
}

.patient-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.patient-meta span,
.status-pill {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--line-dark);
  border-radius: 6px;
  padding: 7px 10px;
}

.header-actions form {
  margin: 0;
}

.workspace-grid {
  display: block;
  padding-top: 0;
}

.conversation-list,
.admin-card,
.auth-card {
  background: var(--surface);
  border: 1px solid var(--line-dark);
  border-radius: var(--radius-lg);
  color: var(--text);
  padding: 18px;
}

.chat {
  display: grid;
  gap: 14px;
  overflow: visible;
  position: relative;
  z-index: 1;
}

.chat-header {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line-dark);
  border-radius: var(--radius-lg);
  display: flex;
  justify-content: space-between;
  padding: 18px 20px;
}

.message-stream {
  background: var(--stream);
  border: 1px solid var(--line-dark);
  border-radius: var(--radius-xl);
  gap: 12px;
  margin-bottom: 0;
  min-height: 420px;
  padding: 18px;
}

.message {
  background: var(--surface-2);
  border: 1px solid var(--line-dark);
  border-radius: var(--radius-lg);
  color: var(--text-soft);
  max-width: 86%;
  padding: 16px 18px;
}

.message--assistant {
  border-left: 0;
  justify-self: start;
}

.message--user {
  background: rgba(30,111,217,0.18);
  border-color: var(--blue-ring);
  border-left: 0;
  justify-self: end;
}

.message__meta {
  color: var(--text-muted);
  margin-bottom: 10px;
}

.message__body p {
  color: var(--text-soft);
  margin-top: 0;
}

.message__sources {
  border-top-color: var(--line-dark);
}

.source-pill {
  background: rgba(255,255,255,0.05);
  border-color: var(--line-dark);
  border-radius: 5px;
  color: var(--text-muted);
}

.composer {
  background: transparent;
  border: 0;
  box-shadow: none;
  margin: 0;
  padding: 0;
}

.composer-block {
  display: block;
}

.composer__surface {
  background: var(--composer-surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-composer);
  box-shadow: 0 16px 48px rgba(0,0,0,0.22);
  display: flex;
  flex-direction: column;
  padding: 14px 16px 12px;
}

.composer__input {
  background: rgba(0,0,0,0.32) !important;
  border: 0 !important;
  border-radius: 12px;
  box-shadow: none !important;
  color: var(--text-soft);
  font-size: 15px;
  line-height: 1.5;
  margin: 0;
  min-height: 108px;
  padding: 10px 12px 12px;
  resize: none;
  width: 100%;
}

.composer__input::placeholder {
  color: var(--text-muted);
  opacity: 0.9;
}

.composer__input:focus {
  background: rgba(0,0,0,0.38) !important;
  box-shadow: none !important;
  outline: none;
}

.composer__footer {
  align-items: center;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
  margin: 10px -2px 0 0;
  padding: 8px 0 0;
}

.composer__trailing {
  align-items: center;
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  min-width: 0;
}

.composer__model {
  align-items: center;
  color: var(--text-muted);
  display: inline-flex;
  font-family: var(--font-mono);
  font-size: 11px;
  gap: 5px;
  letter-spacing: 0.04em;
  user-select: none;
}

.composer__model-label {
  color: var(--text-soft);
}

.composer__chev {
  color: var(--text-muted);
  flex-shrink: 0;
  margin-top: 1px;
  opacity: 0.85;
}

.composer__wave {
  align-items: flex-end;
  display: flex;
  gap: 2px;
  height: 16px;
  margin-right: 2px;
  opacity: 0.45;
  padding: 0 2px;
}

.composer__wave span {
  background: var(--text-soft);
  border-radius: 1px;
  display: block;
  width: 2px;
}

.composer__wave span:nth-child(1) { height: 5px; }
.composer__wave span:nth-child(2) { height: 12px; }
.composer__wave span:nth-child(3) { height: 7px; }
.composer__wave span:nth-child(4) { height: 9px; }

.composer__send {
  align-items: center;
  border-radius: 10px;
  display: flex;
  font-size: 0;
  height: 38px;
  justify-content: center;
  letter-spacing: 0;
  min-width: 40px;
  padding: 0 12px;
  text-transform: none;
}

.composer__send .composer__send-icon {
  display: block;
  margin: 0;
}

.composer__file-input {
  border: 0;
  height: 0.1px;
  opacity: 0;
  overflow: hidden;
  position: absolute;
  width: 0.1px;
  z-index: -1;
}

.composer-menu {
  flex: 0 0 auto;
  list-style: none;
  position: relative;
  z-index: 5;
}

.composer-menu summary::-webkit-details-marker {
  display: none;
}

.composer-menu__trigger {
  align-items: center;
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--line-dark);
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  display: flex;
  height: 36px;
  justify-content: center;
  list-style: none;
  margin: 0;
  padding: 0;
  width: 36px;
}

.composer-menu[open] .composer-menu__trigger,
.composer-menu__trigger:hover {
  background: rgba(255,255,255,0.12);
  border-color: var(--line-strong);
}

.composer-menu__plus {
  font-size: 22px;
  font-weight: 300;
  line-height: 1;
  margin-top: -1px;
}

.composer-menu__panel {
  background: var(--composer-menu);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0,0,0,0.45);
  color: var(--text-soft);
  left: 0;
  min-width: 280px;
  padding: 8px 0;
  position: absolute;
  top: calc(100% + 8px);
  z-index: 30;
}

.composer-menu__item {
  align-items: center;
  color: var(--text-soft);
  cursor: pointer;
  display: flex;
  font-size: 13px;
  gap: 10px;
  line-height: 1.3;
  padding: 10px 14px;
  transition: background 120ms ease, color 120ms ease;
}

label.composer-menu__item {
  margin: 0;
}

.composer-menu__item--stack {
  align-items: stretch;
  cursor: default;
  flex-direction: column;
  gap: 8px;
}

.composer-menu__row {
  align-items: center;
  display: flex;
  gap: 8px;
}

.composer-menu__icn {
  color: var(--text-muted);
  display: flex;
  flex: 0 0 auto;
}

.composer-menu__item:hover {
  background: rgba(255,255,255,0.06);
  color: var(--text);
}

.composer-menu__item:hover .composer-menu__icn {
  color: var(--text-soft);
}

.composer-menu__rule {
  background: var(--line-dark);
  border: 0;
  height: 1px;
  margin: 6px 10px;
}

.composer__links-field {
  background: var(--stream) !important;
  border-color: var(--line-dark) !important;
  border-radius: 8px !important;
  font-size: 12px !important;
  margin: 0 !important;
  min-height: 0 !important;
  padding: 8px 10px !important;
  resize: none;
  width: 100%;
}

.empty-product,
.empty-state {
  background: var(--surface);
  border: 1px solid var(--line-dark);
  border-radius: var(--radius-xl);
  margin: 24px;
}

.auth-shell {
  background:
    radial-gradient(circle at 50% -10%, rgba(30,111,217,0.18), transparent 34rem),
    var(--bg);
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--line-dark);
  border-radius: var(--radius-xl);
  box-shadow: 0 24px 90px rgba(0,0,0,0.38);
}

.clinical-form label {
  color: var(--text-muted);
}

.admin-shell {
  background: var(--bg);
  grid-template-columns: 260px minmax(0, 1fr);
}

.admin-sidebar a,
.admin-sidebar .sidebar-link--button {
  border-top-color: var(--line-dark);
  color: var(--text-soft);
  transition: color 160ms ease;
}

.admin-sidebar a:hover,
.admin-sidebar .sidebar-link--button:hover {
  color: var(--text);
}

.admin-content {
  color: var(--text);
}

.metric-card {
  background: var(--surface);
  border: 1px solid var(--line-dark);
  border-radius: var(--radius-lg);
  padding: 22px;
}

.metric-card strong {
  color: #7db1ff;
  font-size: 38px;
  font-family: var(--font-tight);
  letter-spacing: -0.05em;
  line-height: 0.9;
}

.metric-card span {
  color: var(--text-muted);
}

.admin-table {
  background: var(--surface);
  border: 1px solid var(--line-dark);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.admin-row {
  border-bottom-color: var(--line-dark);
  color: var(--text-soft);
}

.admin-row:hover {
  background: rgba(255,255,255,0.04);
  color: var(--text);
}

@media (max-width: 1100px) {
  .app-shell,
  .admin-shell {
    grid-template-columns: 1fr;
  }

  .app-shell--workspace {
    grid-template-columns: 1fr;
  }

  .composer__footer {
    align-items: stretch;
    flex-direction: column;
  }

  .composer__trailing {
    justify-content: space-between;
    width: 100%;
  }

  .sidebar,
  .conversation-list {
    min-height: auto;
    position: static;
  }

  .workspace-header {
    align-items: stretch;
    flex-direction: column;
  }

  .message {
    max-width: 100%;
  }
}
