:root {
  color-scheme: light;
  --bg: #f7f7f4;
  --panel: #ffffff;
  --panel-soft: #f1f4ef;
  --ink: #1d2730;
  --muted: #667085;
  --line: #d9ded5;
  --brand: #2f7d68;
  --brand-dark: #245f50;
  --accent: #986f2d;
  --danger: #ad3f3f;
  --shadow: 0 16px 45px rgba(29, 39, 48, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body,
.app-shell {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background:
    linear-gradient(rgba(217, 222, 213, 0.45) 1px, transparent 1px),
    linear-gradient(90deg, rgba(217, 222, 213, 0.45) 1px, transparent 1px),
    linear-gradient(135deg, #f7f7f4 0%, #eef2ef 100%);
  background-size: 28px 28px, 28px 28px, auto;
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

body.image-viewer-open,
body.clipboard-image-dialog-open {
  overflow: hidden;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  background: var(--brand);
  border: 0;
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
  font-weight: 800;
  min-height: 42px;
  padding: 0 16px;
}

button:hover {
  background: var(--brand-dark);
}

button.secondary {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
}

button.secondary:hover {
  background: var(--panel-soft);
}

button.danger {
  background: var(--danger);
}

button.danger:hover {
  background: #8d3030;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

button.full {
  width: 100%;
}

input,
textarea,
select {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  outline: none;
  padding: 11px 12px;
  width: 100%;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(47, 125, 104, 0.14);
}

input[readonly] {
  background: var(--panel-soft);
  color: var(--muted);
}

h1,
h2,
p {
  margin-top: 0;
}

.hidden {
  display: none !important;
}

.visually-hidden {
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

.eyebrow {
  color: var(--accent);
  cursor: default;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  margin: 0 0 8px;
  text-transform: uppercase;
}

#roleLabel {
  align-items: center;
  display: inline-flex;
  gap: 7px;
  touch-action: manipulation;
  user-select: none;
}

#roleLabel::after {
  background: transparent;
  border-radius: 999px;
  content: "";
  display: inline-block;
  height: 4px;
  opacity: 0;
  transform: translateY(-1px);
  width: 4px;
}

#roleLabel.has-background-activity::after {
  background: #8c7245;
  opacity: 0.72;
}

#roleLabel.can-edit-remark {
  cursor: pointer;
}

#roleLabel.can-edit-remark:hover {
  color: var(--brand-dark);
}

.boot-view,
.login-view {
  align-items: center;
  display: flex;
  min-height: 100vh;
  justify-content: center;
  padding: 24px;
}

.login-panel,
.account-panel,
.create-box,
.account-settings,
.admin-drawer,
.conversation-drawer,
.group-members-drawer {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.login-panel {
  display: grid;
  gap: 16px;
  max-width: 390px;
  padding: 30px;
  width: 100%;
}

label {
  color: var(--muted);
  display: grid;
  font-size: 14px;
  font-weight: 800;
  gap: 7px;
}

.chat-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

.admin-drawer,
.account-panel,
.conversation-drawer,
.group-members-drawer {
  border-bottom: 0;
  border-radius: 0;
  border-right: 0;
  border-top: 0;
  bottom: 0;
  box-shadow: -20px 0 45px rgba(29, 39, 48, 0.14);
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 420px;
  overflow-y: auto;
  padding: 20px;
  position: fixed;
  right: 0;
  top: 0;
  touch-action: pan-y;
  width: min(420px, 92vw);
  z-index: 8;
}

.admin-drawer-edge {
  display: none;
}

.conversation-drawer-edge {
  display: none;
}

.admin-drawer {
  border-left: 0;
  border-right: 1px solid var(--line);
  box-shadow: 20px 0 45px rgba(29, 39, 48, 0.14);
  left: 0;
  right: auto;
}

.conversation-drawer {
  max-width: 240px;
  padding: 14px;
  width: min(240px, 59vw);
}

.drawer-enter-from-left {
  animation: drawer-enter-from-left 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

.drawer-enter-from-right {
  animation: drawer-enter-from-right 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

.drawer-exit-to-left {
  animation: drawer-exit-to-left 180ms cubic-bezier(0.4, 0, 1, 1);
}

.drawer-exit-to-right {
  animation: drawer-exit-to-right 180ms cubic-bezier(0.4, 0, 1, 1);
}

@keyframes drawer-enter-from-left {
  from { transform: translateX(-100%); }
  to { transform: translateX(0); }
}

@keyframes drawer-enter-from-right {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

@keyframes drawer-exit-to-left {
  from { transform: translateX(0); }
  to { transform: translateX(-100%); }
}

@keyframes drawer-exit-to-right {
  from { transform: translateX(0); }
  to { transform: translateX(100%); }
}

@media (prefers-reduced-motion: reduce) {
  .drawer-enter-from-left,
  .drawer-enter-from-right,
  .drawer-exit-to-left,
  .drawer-exit-to-right {
    animation: none;
  }
}

.admin-drawer > *,
.account-panel > *,
.conversation-drawer > *,
.group-members-drawer > *,
.drawer-header > div:first-child,
.drawer-section,
.account-list,
.conversation-list,
.group-member-list,
.account-settings,
.create-box,
.stack,
.settings-grid {
  min-width: 0;
}

.drawer-header {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.drawer-note {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  margin: 0;
}

.notification-settings {
  display: grid;
  gap: 6px;
  padding-top: 4px;
}

.notification-settings .form-message {
  margin: 0;
}

.credential-warning {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  margin: -4px 0 0;
}

.push-devices {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 8px;
  margin-top: 4px;
  padding-top: 10px;
}

.push-device-count {
  color: var(--muted);
  font-size: 12px;
  margin: 0;
}

.push-device-list {
  display: grid;
  gap: 8px;
}

.push-device {
  align-items: center;
  background: color-mix(in srgb, var(--panel) 84%, var(--line));
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  gap: 8px;
  justify-content: space-between;
  padding: 9px 10px;
}

.push-device-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.push-device-name,
.push-device-meta {
  margin: 0;
}

.push-device-name {
  font-size: 13px;
}

.push-device-meta {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.push-device button {
  flex: 0 0 auto;
  font-size: 11px;
  min-height: 30px;
  padding: 4px 8px;
}

.drawer-section {
  display: grid;
  gap: 10px;
}

.section-heading-row {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.section-heading-row h3 {
  margin: 0;
}

.section-heading-row button {
  font-size: 12px;
  min-height: 30px;
  padding: 4px 10px;
}

.drawer-section h3,
.account-settings h3 {
  font-size: 14px;
  margin: 0;
}

.drawer-header h2,
.topbar h1 {
  margin-bottom: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.topbar h1 {
  align-items: baseline;
  display: flex;
  flex-wrap: wrap;
  font-size: 22px;
  gap: 8px;
  line-height: 1.15;
}

.last-login {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.conversation-state {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  margin: 4px 0 0;
}

.conversation-state.is-active {
  color: var(--brand-dark);
}

.conversation-state.is-online {
  color: var(--brand-dark);
}

.conversation-state.is-typing {
  color: var(--accent);
}

.account-list {
  display: grid;
  gap: 8px;
  overflow-y: auto;
}

.conversation-list,
.group-member-list {
  display: grid;
  gap: 8px;
  min-height: 0;
  overflow-y: auto;
}

.conversation-group-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  margin: 12px 4px 2px;
}

.conversation-audit-manager-label {
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
  margin: 8px 4px 0;
  padding-left: 8px;
  position: relative;
}

.conversation-audit-manager-label::before {
  background: var(--accent);
  border-radius: 999px;
  content: "";
  height: 4px;
  left: 0;
  position: absolute;
  top: 0.55em;
  width: 4px;
}

.conversation-item,
.group-member-item {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  display: flex;
  gap: 10px;
  justify-content: space-between;
  min-width: 0;
  padding: 11px 12px;
  text-align: left;
}

.conversation-item > span,
.group-member-item > span {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.conversation-item strong,
.group-member-item strong,
.conversation-item small,
.group-member-item small {
  overflow-wrap: anywhere;
}

.conversation-item small,
.group-member-item small {
  color: var(--muted);
  font-size: 12px;
}

.conversation-item small.is-active,
.conversation-item small.is-online {
  color: var(--brand-dark);
  font-weight: 800;
}

.conversation-item.active {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(47, 125, 104, 0.12);
}

.unread-badge {
  background: var(--brand-dark);
  border-radius: 999px;
  color: white;
  flex: 0 0 auto;
  font-size: 11px;
  font-style: normal;
  min-width: 24px;
  padding: 4px 7px;
  text-align: center;
}

.member-actions,
.inline-actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  gap: 6px;
}

button.compact {
  min-height: 34px;
  padding: 7px 9px;
}

.choice-list {
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: 8px;
  margin: 0;
  max-height: 240px;
  overflow-y: auto;
  padding: 10px;
}

.choice-list legend {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  padding: 0 5px;
}

.choice-list > div {
  display: grid;
  gap: 8px;
}

.choice-list label {
  align-items: center;
  display: flex;
  font-weight: 700;
}

.choice-list input {
  width: auto;
}

.account-group-label {
  margin: 12px 4px 4px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.account-item[data-tree-depth="1"] {
  margin-left: 14px;
  width: calc(100% - 14px);
}

.account-item {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink);
  display: flex;
  justify-content: space-between;
  max-width: 100%;
  min-height: 50px;
  min-width: 0;
  text-align: left;
}

.account-item span {
  display: grid;
  gap: 2px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.account-item em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
}

.account-item.active {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(47, 125, 104, 0.12);
}

.account-item small {
  color: var(--muted);
  font-weight: 700;
  max-width: 45%;
  overflow-wrap: anywhere;
  text-align: right;
}

.account-item small.is-active,
.account-item small.is-online {
  color: var(--brand-dark);
}

.create-box {
  box-shadow: none;
  padding: 14px;
}

.create-box summary {
  cursor: pointer;
  font-weight: 900;
}

.stack {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.conversation {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: 100%;
  justify-self: center;
  max-height: 100dvh;
  max-width: 100%;
  min-height: 0;
  min-width: 0;
  position: relative;
  width: min(1180px, 100%);
}

.remark-editor {
  animation: remark-editor-enter 150ms cubic-bezier(0.22, 1, 0.36, 1);
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(47, 125, 104, 0.28);
  border-radius: 12px;
  box-shadow: 0 18px 45px rgba(29, 39, 48, 0.18);
  display: grid;
  gap: 12px;
  left: max(12px, calc((100vw - 1180px) / 2 + 18px));
  padding: 15px;
  position: fixed;
  top: calc(72px + env(safe-area-inset-top, 0px));
  width: min(320px, calc(100vw - 24px));
  z-index: 10;
}

.remark-editor-header {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.remark-editor-header h2 {
  font-size: 16px;
  line-height: 1.25;
  margin: 0;
}

.remark-editor-header .eyebrow {
  margin-bottom: 3px;
}

.remark-editor-close {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  display: inline-flex;
  font-size: 22px;
  font-weight: 500;
  height: 30px;
  justify-content: center;
  min-height: 30px;
  padding: 0;
  width: 30px;
}

.remark-editor-close:hover {
  background: var(--panel-soft);
  color: var(--ink);
}

.remark-editor-hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  margin: -4px 0 0;
}

.remark-editor-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.remark-editor-actions button {
  min-height: 36px;
  padding: 0 14px;
}

@keyframes remark-editor-enter {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.topbar {
  align-items: center;
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid var(--line);
  display: flex;
  grid-column: 1;
  grid-row: 1;
  justify-content: space-between;
  gap: 16px;
  padding:
    calc(12px + env(safe-area-inset-top, 0px))
    max(18px, env(safe-area-inset-right, 0px))
    12px
    max(18px, env(safe-area-inset-left, 0px));
  position: sticky;
  top: 0;
  z-index: 3;
}

.topbar > div:first-child {
  flex: 1 1 auto;
  min-width: 0;
}

.topbar .eyebrow {
  margin-bottom: 4px;
}

.topbar-actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  min-width: 0;
}

.account-settings {
  box-shadow: none;
  display: grid;
  gap: 10px;
  padding: 14px;
}

.account-settings.hidden {
  display: none !important;
}

.settings-grid {
  align-items: stretch;
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
}

.account-settings {
  border-radius: 8px;
  box-shadow: none;
}

.checkbox-label {
  align-items: center;
  display: flex;
  gap: 8px;
  min-height: 42px;
}

.checkbox-label input {
  width: auto;
}

.messages {
  align-content: start;
  display: grid;
  gap: 10px;
  grid-column: 1;
  grid-row: 2;
  list-style: none;
  margin: 0;
  min-height: 0;
  min-width: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 22px 22px 28px;
}

.typing-indicator {
  align-self: end;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  grid-column: 1;
  grid-row: 2;
  justify-self: start;
  line-height: 1.2;
  margin: 0 22px 6px;
  max-width: calc(100% - 44px);
  min-width: 0;
  overflow-wrap: anywhere;
  padding: 0 2px;
  pointer-events: none;
  z-index: 2;
}

.message {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 6px 22px rgba(29, 39, 48, 0.05);
  max-width: 100%;
  min-width: 0;
  padding: 13px 14px;
}

.message.theirs {
  border-left: 4px solid #8c7245;
  padding-left: 16px;
}

.message.mine {
  border-right: 4px solid var(--brand);
  padding-right: 16px;
}

.message.is-push-target {
  animation: push-target-highlight 2.5s ease-out;
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

@keyframes push-target-highlight {
  from {
    background: #e8f3eb;
    box-shadow: 0 0 0 5px rgba(54, 105, 72, 0.18);
  }

  to {
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 6px 22px rgba(29, 39, 48, 0.05);
  }
}

.message-meta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 6px;
  overflow-wrap: anywhere;
}

.timeline-event {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: 12px;
  gap: 8px;
  justify-content: center;
  line-height: 1.4;
  padding: 5px 12px;
  text-align: center;
}

.timeline-event time {
  flex: 0 0 auto;
  font-size: 11px;
}

.timeline-truncation {
  font-weight: 700;
}

.message-text {
  line-height: 1.5;
  margin: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.message-delivery {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.message-retry {
  justify-self: end;
  min-height: 36px;
  padding: 6px 10px;
}

.attachment-task {
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 7px;
  margin-top: 8px;
  min-width: min(260px, 68vw);
  padding: 10px;
}

.attachment-task-name {
  font-size: 13px;
  overflow-wrap: anywhere;
}

.attachment-task-size,
.attachment-task-status {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.attachment-task-progress {
  accent-color: var(--accent);
  height: 7px;
  width: 100%;
}

.attachment-task-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.attachment-task-action {
  font-size: 12px;
  min-height: 32px;
  padding: 5px 10px;
}

.media-box {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  max-width: 100%;
  min-width: 0;
}

.media-video-box {
  position: relative;
}

.video-buffer-status {
  background: rgba(21, 31, 29, 0.82);
  border-radius: 999px;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  left: 50%;
  max-width: calc(100% - 24px);
  padding: 7px 11px;
  pointer-events: none;
  position: absolute;
  text-align: center;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 1;
}

.media-box img,
.media-box video {
  border-radius: 8px;
  max-height: 420px;
  max-width: 100%;
}

.media-box .media-image-link {
  background: transparent;
  border: 0;
  border-radius: 8px;
  display: block;
  justify-self: start;
  max-width: min(100%, 320px);
  min-height: 0;
  padding: 0;
  text-align: left;
}

.media-box .media-image-link:hover {
  background: transparent;
}

.media-box .media-image-link:focus-visible {
  outline: 3px solid rgba(47, 125, 104, 0.35);
  outline-offset: 3px;
}

.media-image-link img {
  display: block;
  height: auto;
  max-height: 320px;
  object-fit: contain;
}

.media-box audio {
  max-width: 360px;
  min-width: 0;
  width: 100%;
}

.media-box audio.is-loading {
  opacity: 0.62;
  pointer-events: none;
}

.complete-audio-status {
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  justify-self: start;
  min-height: 28px;
  padding: 2px 0;
}

.complete-audio-status:not(:disabled) {
  color: var(--brand-dark);
  cursor: pointer;
  font-weight: 800;
}

.media-box a {
  color: var(--brand-dark);
  font-size: 13px;
  font-weight: 800;
  min-width: 0;
  overflow-wrap: anywhere;
}

.media-box > span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.media-preview-error {
  color: var(--muted);
  font-size: 13px;
}

.media-preview-retry {
  color: var(--brand-dark);
  display: block;
  font-size: 13px;
  font-weight: 800;
  padding: 12px;
}

.image-viewer {
  align-items: center;
  background: rgba(10, 14, 18, 0.96);
  display: grid;
  inset: 0;
  justify-items: center;
  overscroll-behavior: contain;
  padding:
    calc(18px + env(safe-area-inset-top, 0px))
    calc(18px + env(safe-area-inset-right, 0px))
    calc(18px + env(safe-area-inset-bottom, 0px))
    calc(18px + env(safe-area-inset-left, 0px));
  position: fixed;
  z-index: 1000;
}

.image-viewer-image {
  display: block;
  max-height: calc(100dvh - 36px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  max-width: 100%;
  object-fit: contain;
  user-select: none;
}

.image-viewer-close {
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #fff;
  min-height: 44px;
  position: absolute;
  right: calc(14px + env(safe-area-inset-right, 0px));
  top: calc(14px + env(safe-area-inset-top, 0px));
  z-index: 1;
}

.media-original-save {
  background: transparent;
  color: var(--brand-dark);
  font-size: 13px;
  justify-self: start;
  min-height: 32px;
  padding: 0;
}

.media-original-save:hover {
  background: transparent;
  text-decoration: underline;
}

.image-viewer-save {
  align-items: center;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 8px;
  color: #fff;
  display: inline-flex;
  font-weight: 800;
  left: calc(14px + env(safe-area-inset-left, 0px));
  min-height: 44px;
  padding: 0 16px;
  position: absolute;
  text-decoration: none;
  top: calc(14px + env(safe-area-inset-top, 0px));
  z-index: 1;
}

.image-viewer-save:hover {
  background: rgba(255, 255, 255, 0.24);
}

.image-viewer-close:hover {
  background: rgba(255, 255, 255, 0.24);
}

.clipboard-image-dialog {
  align-items: center;
  background: rgba(29, 39, 48, 0.55);
  display: flex;
  inset: 0;
  justify-content: center;
  padding:
    calc(18px + env(safe-area-inset-top, 0px))
    calc(18px + env(safe-area-inset-right, 0px))
    calc(18px + env(safe-area-inset-bottom, 0px))
    calc(18px + env(safe-area-inset-left, 0px));
  position: fixed;
  z-index: 1001;
}

.clipboard-image-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  max-width: 360px;
  padding: 18px;
  width: 100%;
}

.clipboard-image-card .eyebrow {
  margin-bottom: 4px;
}

.clipboard-image-card h2 {
  font-size: 20px;
  margin-bottom: 14px;
}

.clipboard-image-preview {
  background:
    linear-gradient(45deg, var(--panel-soft) 25%, transparent 25%),
    linear-gradient(-45deg, var(--panel-soft) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--panel-soft) 75%),
    linear-gradient(-45deg, transparent 75%, var(--panel-soft) 75%);
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: block;
  height: 180px;
  object-fit: contain;
  width: 100%;
}

.clipboard-image-summary,
.clipboard-image-hint {
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.clipboard-image-summary {
  margin: 12px 0 4px;
}

.clipboard-image-hint {
  margin-bottom: 8px;
}

.clipboard-image-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 12px;
}

.clipboard-image-actions button {
  min-width: 112px;
}

.composer {
  align-items: start;
  background: rgba(255, 255, 255, 0.92);
  border-top: 1px solid var(--line);
  display: grid;
  gap: 8px;
  grid-column: 1;
  grid-template-columns: auto minmax(0, 1fr) auto auto auto;
  grid-row: 3;
  padding:
    10px
    max(18px, env(safe-area-inset-right, 0px))
    calc(10px + env(safe-area-inset-bottom, 0px))
    max(18px, env(safe-area-inset-left, 0px));
  position: relative;
}

.composer-main {
  display: grid;
  gap: 8px;
  min-width: 0;
}

textarea {
  max-height: 132px;
  min-height: 42px;
  resize: none;
}

.attach-button {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  font-size: 22px;
  font-weight: 900;
  justify-content: center;
  min-height: 42px;
  min-width: 42px;
  padding: 0;
}

.attach-button input {
  display: none;
}

.file-status-row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 0;
  min-width: 0;
}

.voice-button,
.emoji-button,
.send-button {
  font-size: 20px;
  min-height: 42px;
  min-width: 42px;
  padding: 0;
}

.voice-button,
.emoji-button {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink);
}

.voice-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  bottom: calc(100% + 8px);
  box-shadow: var(--shadow);
  display: grid;
  gap: 10px;
  left: max(18px, env(safe-area-inset-left, 0px));
  padding: 12px;
  position: absolute;
  right: max(18px, env(safe-area-inset-right, 0px));
  z-index: 9;
}

.voice-panel-summary {
  align-items: center;
  display: flex;
  gap: 8px;
  min-height: 20px;
}

.voice-panel-summary #voiceStatus {
  color: var(--muted);
  flex: 1;
  font-size: 13px;
  font-weight: 800;
}

.voice-panel-summary time {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  font-weight: 900;
}

.voice-recording-dot {
  background: var(--muted);
  border-radius: 999px;
  height: 8px;
  width: 8px;
}

.voice-panel.is-recording .voice-recording-dot {
  background: #b44336;
}

.voice-preview {
  height: 38px;
  max-width: 100%;
  width: 100%;
}

.voice-panel-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.voice-panel-actions button {
  min-height: 34px;
  padding: 0 14px;
}

.emoji-picker {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  bottom: calc(100% + 8px);
  box-shadow: var(--shadow);
  display: grid;
  gap: 4px;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  max-height: min(260px, 45dvh);
  overflow-y: auto;
  padding: 8px;
  position: absolute;
  right: max(18px, env(safe-area-inset-right, 0px));
  width: min(320px, calc(100% - 36px));
  z-index: 8;
}

.emoji-choice {
  align-items: center;
  background: transparent;
  color: var(--ink);
  display: flex;
  font-size: 24px;
  justify-content: center;
  min-height: 42px;
  min-width: 0;
  padding: 0;
}

.emoji-choice:hover,
.emoji-choice:focus-visible {
  background: var(--panel-soft);
}

.file-status {
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  flex: 1 1 180px;
  line-height: 1.35;
  max-width: 100%;
  min-width: 0;
  overflow-wrap: anywhere;
  padding: 7px 10px;
}

.clear-file-button {
  color: var(--muted);
  font-size: 12px;
  min-height: 31px;
  padding: 0 10px;
}

.form-message {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  margin: 0;
  overflow-wrap: anywhere;
}

.form-message.error {
  color: var(--danger);
}

.empty {
  align-self: center;
  color: var(--muted);
  margin: auto;
  text-align: center;
}

@media (max-width: 1050px) {
  .conversation {
    width: 100%;
  }
}

@media (max-width: 760px) {
  input,
  textarea,
  select {
    font-size: 16px;
  }

  .topbar {
    align-items: center;
    gap: 8px;
    padding:
      calc(7px + env(safe-area-inset-top, 0px))
      max(10px, env(safe-area-inset-right, 0px))
      7px
      max(10px, env(safe-area-inset-left, 0px));
  }

  .remark-editor {
    left: 12px;
    top: calc(56px + env(safe-area-inset-top, 0px));
  }

  .topbar h1 {
    font-size: 16px;
    gap: 5px;
  }

  .topbar .eyebrow {
    font-size: 10px;
    letter-spacing: 0.06em;
    margin-bottom: 1px;
  }

  .conversation-state {
    font-size: 11px;
    margin-top: 1px;
  }

  .topbar-actions {
    flex: 0 1 auto;
    flex-wrap: wrap;
    gap: 5px;
    max-width: 52%;
  }

  .topbar-actions button {
    flex: 1 1 auto;
    font-size: 12px;
    min-height: 30px;
    min-width: 44px;
    padding: 0 9px;
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }

  .messages {
    gap: 8px;
    padding:
      10px
      max(10px, env(safe-area-inset-right, 0px))
      26px
      max(10px, env(safe-area-inset-left, 0px));
  }

  .typing-indicator {
    margin:
      0
      max(10px, env(safe-area-inset-right, 0px))
      5px
      max(10px, env(safe-area-inset-left, 0px));
    max-width: calc(100% - 20px);
  }

  .composer {
    grid-template-columns: auto minmax(0, 1fr) auto auto auto;
    padding:
      7px
      max(10px, env(safe-area-inset-right, 0px))
      calc(7px + env(safe-area-inset-bottom, 0px))
      max(10px, env(safe-area-inset-left, 0px));
  }

  textarea {
    max-height: 96px;
    min-height: 38px;
    padding: 8px 10px;
  }

  .attach-button,
  .voice-button,
  .emoji-button,
  .send-button {
    min-height: 38px;
    min-width: 38px;
  }
}

@media (max-width: 900px), (pointer: coarse) {
  .admin-drawer-edge:not(.hidden) {
    bottom: 0;
    display: block;
    position: fixed;
    left: 0;
    top: 0;
    touch-action: pan-y;
    width: max(24px, env(safe-area-inset-left, 0px));
    z-index: 7;
  }

  .conversation-drawer-edge:not(.hidden) {
    bottom: 0;
    display: block;
    position: fixed;
    right: 0;
    top: 0;
    touch-action: pan-y;
    width: max(24px, env(safe-area-inset-right, 0px));
    z-index: 7;
  }
}
