:root {
  --x-navy: #2C2760;
  --x-red: #E30613;
  --x-black: #000000;
  --x-gray-mono: #9D9D9C;
  --x-navy-700: #221D4E;
  --x-navy-900: #14112E;
  --x-navy-tint: #EAE9F2;
  --x-red-700: #B8050F;
  --x-red-tint: #FCE6E7;
  --x-grad: linear-gradient(120deg, #2C2760 0%, #1C1836 46%, #4A0E14 66%, #E30613 100%);

  --gray-0: #FFFFFF;
  --gray-25: #FBFBFD;
  --gray-50: #F3F3F7;
  --gray-100: #E9E9EF;
  --gray-200: #DDDDE5;
  --gray-300: #C6C6D1;
  --gray-400: #9A9AA8;
  --gray-500: #6C6C7C;
  --gray-600: #4E4E5E;
  --gray-700: #37374A;

  --fg-1: var(--x-navy);
  --fg-2: var(--gray-500);
  --fg-3: var(--gray-400);
  --fg-on-dark: #FFFFFF;
  --bg-app: var(--gray-50);
  --surface-1: #FFFFFF;
  --surface-2: var(--gray-25);
  --border: var(--gray-200);
  --border-strong: var(--gray-300);

  --ok: #1E9E57;
  --ok-bg: #E4F6EC;
  --warn: #B9810A;
  --warn-bg: #FCF1D6;
  --err: var(--x-red);
  --err-bg: var(--x-red-tint);

  --font-brand: "Poppins", "Segoe UI", Arial, sans-serif;
  --font-mono: "SFMono-Regular", ui-monospace, Consolas, "Liberation Mono", monospace;

  --text-display: 700 34px/1.18 var(--font-brand);
  --text-h1: 700 26px/1.22 var(--font-brand);
  --text-h2: 600 20px/1.3 var(--font-brand);
  --text-h3: 600 16px/1.35 var(--font-brand);
  --text-body: 400 14px/1.55 var(--font-brand);
  --text-sm: 400 13px/1.5 var(--font-brand);
  --text-label: 600 12px/1.3 var(--font-brand);
  --text-caption: 400 12px/1.45 var(--font-brand);
  --text-mono: 500 12.5px/1.4 var(--font-mono);
  --eyebrow: 600 11px/1.2 var(--font-brand);

  --r-xs: 4px;
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 16px;
  --r-pill: 999px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-7: 32px;
  --shadow-xs: 0 1px 2px rgba(20, 17, 46, 0.06);
  --shadow-sm: 0 1px 3px rgba(20, 17, 46, 0.08), 0 1px 2px rgba(20, 17, 46, 0.04);
  --shadow-md: 0 4px 12px rgba(20, 17, 46, 0.09), 0 1px 3px rgba(20, 17, 46, 0.05);
  --dur-fast: 120ms;
  --dur: 180ms;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg-app);
  color: var(--fg-1);
  font: var(--text-body);
  background-image:
    radial-gradient(ellipse 80% 50% at 100% -10%, rgba(44, 39, 96, 0.08), transparent 55%),
    radial-gradient(ellipse 60% 40% at 0% 100%, rgba(227, 6, 19, 0.04), transparent 50%);
}

body.consent-required {
  overflow: hidden;
}

.app {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
  max-width: 1400px;
  margin: 0 auto;
}

.side {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 28px 22px;
  border-right: 1px solid var(--border);
  background: var(--surface-1);
  position: sticky;
  top: 0;
  height: 100vh;
}

.side .logo {
  width: 118px;
  height: auto;
  margin-bottom: 8px;
  display: block;
}

.side .tagline {
  font: var(--text-caption);
  color: var(--fg-3);
  margin: 0 0 20px;
}

.navtitle {
  font: var(--eyebrow);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--fg-3);
  margin: 12px 0 8px;
}

.side label.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.side label.field span {
  font: var(--text-label);
  color: var(--fg-2);
}
.debug-tag {
  font: var(--eyebrow);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--x-red);
  margin-left: 6px;
}

.side select,
.side input[type="number"],
.side input[type="range"],
.side textarea {
  font: var(--text-sm);
  color: var(--fg-1);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 8px 10px;
  outline: none;
  transition: border-color var(--dur-fast) var(--ease);
}

.side select:focus,
.side input:focus,
.side textarea:focus {
  border-color: var(--x-navy);
}

.side textarea {
  resize: vertical;
  min-height: 64px;
}

.session-new-btn {
  width: 100%;
  justify-content: center;
  margin-bottom: 12px;
}

.session-history {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.session-history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
  padding-right: 2px;
}

.session-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  width: 100%;
  text-align: left;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 9px 10px;
  cursor: pointer;
}

.session-item:hover,
.session-item.active {
  border-color: var(--x-navy);
  background: var(--x-navy-tint);
}

.session-item-title {
  font: var(--text-label);
  color: var(--fg-1);
}

.session-item-meta,
.session-item-preview {
  font: var(--text-caption);
  color: var(--fg-2);
}

.session-item-preview {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.consent-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 17, 46, 0.58);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}

.consent-overlay[hidden] {
  display: none !important;
}

.consent-card {
  width: min(760px, 100%);
  max-height: min(88vh, 920px);
  overflow: auto;
  background: var(--surface-1);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-md);
  padding: 22px;
}

.consent-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: var(--r-pill);
  background: var(--x-red-tint);
  color: var(--x-red);
  font: var(--eyebrow);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 6px 10px;
}

.consent-card h2 {
  margin: 12px 0 8px;
  font: var(--text-h2);
}

.consent-actor {
  margin: 0 0 8px;
  font: var(--text-label);
  color: var(--fg-1);
}

.consent-summary,
.consent-foot {
  margin: 0;
  color: var(--fg-2);
}

.consent-policy {
  display: grid;
  gap: 10px;
  margin: 18px 0;
}

.consent-item {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 14px;
}

.consent-item h3 {
  margin: 0 0 6px;
  font: var(--text-label);
}

.consent-item p {
  margin: 0;
  color: var(--fg-2);
}

.consent-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 14px;
}

.consent-check input {
  margin-top: 2px;
}

.consent-actions {
  display: flex;
  justify-content: flex-end;
}

.privacy-log {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
  min-height: 0;
  /* Fill leftover sidebar space on desktop only — not on phone drawer */
  flex: 1 1 auto;
}
.privacy-log-hint {
  margin: 0;
  font: var(--text-caption);
  color: var(--fg-3);
  position: relative;
  z-index: 0;
}
.privacy-log-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
  padding-right: 2px;
}
.privacy-log-item {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--x-red);
  border-radius: var(--r-sm);
  padding: 8px 10px;
  text-align: left;
  width: 100%;
  color: inherit;
  font: inherit;
  display: block;
  cursor: default;
}
.privacy-log-item.is-clickable {
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.privacy-log-item.is-clickable:hover {
  background: color-mix(in srgb, var(--x-red) 8%, var(--surface-2));
  border-color: color-mix(in srgb, var(--x-red) 35%, var(--border));
}
.privacy-log-action {
  margin-top: 6px;
  font: var(--text-caption);
  color: var(--x-red);
  font-weight: 600;
}
.privacy-open-banner {
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  border: 1px solid color-mix(in srgb, var(--x-red) 35%, var(--border));
  background: color-mix(in srgb, var(--x-red) 10%, var(--surface));
  font: var(--text-caption);
  color: var(--fg-2);
}
.privacy-open-banner[hidden] {
  display: none;
}
.privacy-log-title {
  font: var(--text-label);
  color: var(--fg-1);
  margin-bottom: 4px;
}
.privacy-log-meta {
  font: var(--text-caption);
  color: var(--fg-2);
}
.privacy-log-empty {
  margin: 0;
  font: var(--text-caption);
  color: var(--fg-3);
}
.privacy-log-refresh {
  align-self: flex-start;
  padding: 6px 10px;
  font: var(--text-caption);
}

.consent-status {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
  padding: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
}

.consent-status-text {
  margin: 0;
  font: var(--text-caption);
  color: var(--fg-2);
}

.consent-open-btn {
  align-self: flex-start;
  padding: 6px 10px;
  font: var(--text-caption);
}

.side .navfoot {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font: var(--text-caption);
  color: var(--fg-3);
}

.secmark {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.secmark .bar {
  width: 26px;
  height: 9px;
  border-radius: 4px;
  background: var(--x-red);
}

.secmark .n {
  font: var(--text-mono);
  font-size: 12px;
  color: var(--x-red);
  letter-spacing: 0.06em;
}

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 28px 12px;
}

.topbar h1 {
  font: var(--text-h1);
  margin: 0;
  color: var(--x-navy);
}

.topbar h1 em {
  font-style: normal;
  color: var(--x-red);
}

.topbar .lede {
  margin: 4px 0 0;
  font: var(--text-sm);
  color: var(--fg-2);
}

.top-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.btn {
  font: var(--text-label);
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  padding: 9px 14px;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}

.btn-primary {
  background: var(--x-navy);
  color: #fff;
}

.btn-primary:hover { background: var(--x-navy-700); }
.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--surface-1);
  color: var(--x-navy);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: var(--gray-50);
  border-color: var(--border-strong);
}

.btn-ghost {
  background: transparent;
  color: var(--fg-2);
  border-color: transparent;
}

.btn-ghost:hover { color: var(--x-navy); background: var(--x-navy-tint); }

.chat-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  margin: 0 28px 28px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  min-height: 0;
  position: relative;
}

.chat-shell::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 4px;
  background: var(--x-grad);
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 28px 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 320px;
}

.empty {
  margin: auto;
  text-align: center;
  max-width: 420px;
  color: var(--fg-2);
  padding: 40px 20px;
}

.empty .brand-mark {
  font: 700 28px/1 var(--font-brand);
  color: var(--x-navy);
  letter-spacing: -0.02em;
  margin-bottom: 10px;
}

.empty .brand-mark span {
  color: var(--x-red);
}

.empty p {
  margin: 0;
  font: var(--text-sm);
  color: var(--fg-3);
}

.bubble {
  max-width: min(720px, 92%);
  animation: rise 220ms var(--ease);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.bubble.user { align-self: flex-end; }
.bubble.assistant { align-self: flex-start; }

.bubble-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.bubble-role {
  font: var(--eyebrow);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-3);
}

.bubble-actions {
  display: flex;
  gap: 8px;
}

.linkish {
  font: var(--text-caption);
  color: var(--fg-3);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

.linkish:hover { color: var(--x-red); }

.bubble-body {
  padding: 12px 16px;
  border-radius: var(--r-lg);
  font: var(--text-body);
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: var(--shadow-xs);
}

.bubble.user .bubble-body {
  background: var(--x-navy);
  color: #fff;
  border-bottom-right-radius: var(--r-xs);
}

.bubble.assistant .bubble-body {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--fg-1);
  border-bottom-left-radius: var(--r-xs);
}

.attach-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.attach-inline img {
  max-width: 160px;
  max-height: 100px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
}

.attach-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--x-navy-tint);
  border-radius: var(--r-sm);
  font: var(--text-caption);
  color: var(--x-navy);
}

.attach-chip img {
  width: 28px;
  height: 28px;
  object-fit: cover;
  border-radius: 4px;
}

.attach-chip button {
  border: 0;
  background: transparent;
  color: var(--fg-3);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}

.composer-wrap {
  border-top: 1px solid var(--border);
  padding: 14px 16px 16px;
  background: var(--gray-25);
}

.attachments-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.composer-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.attach-btn {
  font: var(--text-label);
  color: var(--x-navy);
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 7px 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.attach-btn:hover {
  border-color: var(--x-navy);
  background: var(--x-navy-tint);
}

.hint {
  font: var(--text-caption);
  color: var(--fg-3);
}

.composer-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
}

#chat-input {
  width: 100%;
  resize: none;
  min-height: 72px;
  max-height: 200px;
  font: var(--text-body);
  color: var(--fg-1);
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 14px;
  outline: none;
}

#chat-input:focus {
  border-color: var(--x-navy);
  box-shadow: 0 0 0 3px rgba(44, 39, 96, 0.12);
}

.composer-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#chat-meta {
  margin: 8px 0 0;
  font: var(--text-mono);
  font-size: 11px;
  color: var(--fg-3);
}

.temp-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.temp-row input[type="range"] {
  flex: 1;
  accent-color: var(--x-navy);
}

/* —— Phone UI (real narrow screens OR forced preview) —— */
.mobile-bar,
.side-backdrop,
.side-mobile-head {
  display: none;
}

.side .logo-desktop {
  display: block;
}

body:not(.phone-ui) .side-mobile-head {
  display: none !important;
}

body:not(.phone-ui) .phone-exit-btn {
  display: none !important;
}

.phone-preview-btn.is-active {
  background: var(--x-navy);
  color: #fff;
  border-color: var(--x-navy);
}

body.force-phone {
  background:
    radial-gradient(ellipse 70% 50% at 50% 0%, rgba(44, 39, 96, 0.45), transparent 55%),
    #14112e;
  min-height: 100dvh;
}

body.force-phone .app {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 390px;
  max-width: calc(100vw - 24px);
  height: min(844px, calc(100dvh - 32px));
  min-height: 0;
  border-radius: 28px;
  overflow: hidden;
  border: 3px solid #2c2760;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06),
    0 24px 60px rgba(0, 0, 0, 0.45);
  background: var(--bg-app);
  margin: 0;
}

body.phone-ui {
  height: 100%;
  height: 100dvh;
  overflow: hidden;
}

body.phone-ui .app {
  display: flex;
  flex-direction: column;
  grid-template-columns: none;
  max-width: none;
  min-height: 100dvh;
  height: 100dvh;
}

body.force-phone.phone-ui .app {
  min-height: 0;
  height: min(844px, calc(100dvh - 32px));
}

body.phone-ui .mobile-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-shrink: 0;
  padding: calc(8px + env(safe-area-inset-top, 0px)) 12px 8px;
  background: var(--surface-1);
  border-bottom: 1px solid var(--border);
  z-index: 30;
}

body.phone-ui .mobile-logo {
  height: 28px;
  width: auto;
}

body.phone-ui .mobile-icon-btn {
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface-2);
  color: var(--x-navy);
  font-size: 22px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

body.phone-ui .mobile-icon-btn:active {
  background: var(--x-navy-tint);
}

body.phone-ui .mobile-new {
  font-weight: 600;
  color: var(--x-red);
}

body.phone-ui .burger {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--x-navy);
  box-shadow: 0 -6px 0 var(--x-navy), 0 6px 0 var(--x-navy);
}

body.phone-ui .phone-exit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  padding: 0 10px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border);
  background: var(--x-navy-tint);
  color: var(--x-navy);
  font: var(--text-caption);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

body.phone-ui .side-backdrop {
  display: block;
  position: fixed;
  inset: 0;
  background: rgba(20, 17, 46, 0.45);
  z-index: 40;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s var(--ease);
}

body.force-phone.phone-ui .side-backdrop {
  position: absolute;
  border-radius: 28px;
}

body.force-phone.phone-ui .app {
  position: relative;
}

body.phone-ui .side-backdrop:not([hidden]) {
  opacity: 1;
  pointer-events: auto;
}

body.phone-ui.menu-open .side-backdrop:not([hidden]) {
  opacity: 1;
  pointer-events: auto;
}

body.phone-ui .side {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(320px, 88vw);
  height: 100dvh;
  z-index: 50;
  transform: translateX(-105%);
  transition: transform 0.22s var(--ease);
  border-right: 1px solid var(--border);
  border-bottom: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: calc(12px + env(safe-area-inset-top, 0px)) 16px calc(16px + env(safe-area-inset-bottom, 0px));
  -webkit-overflow-scrolling: touch;
  gap: 8px;
  /* Prevent flex children from collapsing over each other */
  align-content: flex-start;
}

body.force-phone.phone-ui .side {
  position: absolute;
  height: 100%;
  border-radius: 28px 0 0 28px;
}

body.phone-ui.menu-open .side {
  transform: translateX(0);
  box-shadow: var(--shadow-md);
}

body.phone-ui .side-mobile-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  flex-shrink: 0;
}

body.phone-ui .side-mobile-head .logo {
  width: 100px;
  margin: 0;
}

body.phone-ui .side .logo-desktop {
  display: none;
}

body.phone-ui .side .tagline {
  margin-bottom: 12px;
  flex-shrink: 0;
}

body.phone-ui .navtitle {
  flex: 0 0 auto;
  position: relative;
  z-index: 1;
  margin: 14px 0 8px;
  color: var(--fg-3);
  background: var(--surface-1);
  padding: 2px 0;
}

body.phone-ui .session-history,
body.phone-ui .consent-status,
body.phone-ui .side label.field,
body.phone-ui .session-new-btn {
  flex: 0 0 auto;
}

body.phone-ui .privacy-log {
  flex: 0 0 auto;
  margin-bottom: 8px;
  overflow: visible;
}

body.phone-ui .session-history-list {
  max-height: 22vh;
}

body.phone-ui .privacy-log-list {
  max-height: 22vh;
}

body.phone-ui .side .navfoot {
  margin-top: 16px;
  flex: 0 0 auto;
}

body.phone-ui .main {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  height: auto;
}

body.phone-ui .topbar {
  display: none;
}

body.phone-ui .chat-shell {
  flex: 1;
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

body.phone-ui .messages {
  flex: 1;
  min-height: 0;
  padding: 12px 12px 8px;
  -webkit-overflow-scrolling: touch;
}

body.phone-ui .msg {
  max-width: 92%;
}

body.phone-ui .composer-wrap {
  flex-shrink: 0;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border);
  background: var(--surface-1);
}

body.phone-ui .composer-hint-desktop {
  display: none;
}

body.phone-ui .composer-row {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

body.phone-ui .composer-row textarea {
  min-height: 48px;
  max-height: 120px;
  font-size: 16px;
  border-radius: var(--r-md);
  padding: 12px;
}

body.phone-ui .composer-actions {
  display: flex;
  gap: 8px;
  width: 100%;
}

body.phone-ui .composer-actions .btn {
  flex: 1;
  min-height: 48px;
  font-size: 15px;
  border-radius: var(--r-md);
}

body.phone-ui .attach-btn {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
}

body.phone-ui .consent-overlay {
  padding: 12px;
  align-items: flex-end;
}

body.force-phone.phone-ui .consent-overlay {
  position: absolute;
  border-radius: 28px;
  inset: 0;
}

body.phone-ui .consent-card {
  width: 100%;
  max-height: min(92dvh, 920px);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  padding: 18px 16px calc(16px + env(safe-area-inset-bottom, 0px));
}

body.phone-ui .consent-actions {
  flex-direction: column-reverse;
  gap: 8px;
}

body.phone-ui .consent-actions .btn {
  width: 100%;
  min-height: 48px;
}

body.phone-ui .privacy-open-banner {
  margin: 8px 12px 0;
}

body.phone-ui #chat-meta {
  font-size: 10px;
  word-break: break-all;
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
