:root {
  color-scheme: light;
  --sidebar-width: 320px;
  --bg: #f6f3ee;
  --panel: #fffdf9;
  --panel-strong: #ffffff;
  --ink: #25231f;
  --muted: #6e6a61;
  --line: #dfdad0;
  --line-soft: #ece7dd;
  --accent: #2f6f73;
  --accent-2: #8c4f2f;
  --accent-soft: #e4f1ef;
  --danger: #b94444;
  --shadow: 0 14px 44px rgba(42, 35, 25, 0.08);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  height: 100vh;
  min-height: 100vh;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
}

#app {
  height: 100%;
  min-height: 0;
}

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

button {
  cursor: pointer;
}

.app-frame {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.app-frame.sidebar-closed {
  grid-template-columns: minmax(0, 1fr);
}

.sidebar {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  flex: 0 0 var(--sidebar-width);
  width: var(--sidebar-width);
  height: 100%;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  border-right: 1px solid var(--line);
  background: #eee8dc;
  scrollbar-gutter: stable;
}

.app-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-height: 0;
  padding: 10px 7px;
  border-right: 1px solid rgba(37, 35, 31, 0.08);
  background: #f6f3ee;
}

.app-rail-mark,
.app-rail-button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
}

.app-rail-mark {
  margin-bottom: 8px;
  border-radius: 10px;
  background: var(--ink);
  color: #fffdf9;
}

.app-rail-button {
  gap: 2px;
  height: 48px;
  padding: 4px 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.1;
}

.app-rail-button span {
  max-width: 46px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-rail-button.selected,
.app-rail-button:hover {
  border-color: var(--line-soft);
  background: #fffdf9;
  color: var(--accent);
}

.app-rail-spacer {
  flex: 1;
}

.sidebar-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: 10px 8px;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

.workspace-switcher {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 3px 5px 8px;
}

.workspace-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--ink);
  color: #fffdf9;
}

.workspace-copy {
  display: grid;
  min-width: 0;
}

.workspace-copy strong,
.workspace-copy span,
.page-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-copy span {
  color: var(--muted);
  font-size: 12px;
}

.settings-panel {
  display: grid;
  gap: 10px;
  margin: 10px 3px 12px;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgba(255, 253, 249, 0.72);
}

.settings-row,
.settings-grid,
.settings-actions {
  display: grid;
  gap: 6px;
}

.settings-row {
  grid-template-columns: minmax(0, 1fr);
}

.settings-row span,
.settings-grid span,
.settings-field span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.integrations-panel,
.token-list {
  display: grid;
  gap: 8px;
}

.mcp-instructions {
  display: grid;
  gap: 5px;
  padding: 8px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #fffdf9;
}

.mcp-instructions strong {
  color: var(--ink);
  font-size: 13px;
}

.mcp-instructions code {
  overflow: hidden;
  color: var(--accent);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mcp-instructions small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.scope-options,
.feature-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.scope-option {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}

.created-token,
.token-row {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #fffdf9;
}

.token-row {
  grid-template-columns: minmax(0, 1fr) minmax(54px, auto) 30px;
  align-items: center;
}

.agent-proposal-row,
.agent-activity-row {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #fffdf9;
}

.agent-proposal-row {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.agent-proposal-actions {
  display: inline-flex;
  gap: 4px;
}

.agent-proposal-row strong,
.agent-proposal-row small,
.agent-activity-row strong,
.agent-activity-row small,
.agent-activity-row em {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-proposal-row small,
.agent-activity-row small,
.agent-activity-row em {
  color: var(--muted);
  font-size: 11px;
}

.created-token code {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
}

.token-row strong,
.token-row small,
.token-row em {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.token-row small,
.token-row em {
  color: var(--muted);
  font-size: 11px;
}

.settings-row strong,
.settings-grid strong {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-field {
  display: grid;
  gap: 5px;
}

.settings-field input {
  width: 100%;
  min-height: 34px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  background: #fffdf9;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
}

.settings-field input:disabled {
  color: var(--muted);
}

.settings-grid {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.member-list {
  display: grid;
  gap: 5px;
}

.member-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 8px;
  padding: 6px 7px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
}

.member-row span,
.member-row small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member-row small {
  color: var(--muted);
  font-size: 11px;
}

.member-row em {
  grid-row: 1 / 3;
  grid-column: 2;
  align-self: center;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}

.settings-actions {
  grid-template-columns: minmax(0, 1fr);
}

.settings-logout {
  min-height: 30px;
  margin-top: 0;
  text-align: center;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
}

.icon-button:hover,
.icon-button.active {
  border-color: var(--line);
  background: var(--panel);
  color: var(--ink);
}

.icon-button.danger:hover {
  color: var(--danger);
}

.search-box {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  margin: 14px 3px 8px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 249, 0.72);
  color: var(--muted);
}

.search-box input {
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.sidebar-section {
  display: grid;
  align-content: start;
  grid-auto-rows: max-content;
  gap: 2px;
  margin-top: 8px;
}

.sidebar-section.grow {
  flex: none;
  min-height: auto;
  overflow: visible;
}

.section-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 22px;
  padding: 2px 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.section-label .icon-button {
  width: 22px;
  height: 22px;
  border-radius: 6px;
}

.page-row-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 24px;
  align-items: center;
  gap: 2px;
  padding-left: calc(var(--page-depth, 0) * 14px);
}

.page-row-shell > .icon-button {
  width: 22px;
  height: 22px;
  opacity: 0;
}

.page-row-shell:hover > .icon-button,
.page-row-shell:focus-within > .icon-button {
  opacity: 1;
}

.page-row {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) 14px;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-height: 24px;
  padding: 2px 5px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.25;
  text-align: left;
}

.page-row:hover,
.page-row.selected {
  border-color: rgba(47, 111, 115, 0.14);
  background: rgba(255, 253, 249, 0.78);
}

.page-row.keyboard-selected {
  border-color: rgba(47, 111, 115, 0.32);
  background: #fffdf9;
  box-shadow: inset 2px 0 0 var(--accent);
}

.trash-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 30px;
  align-items: center;
  gap: 4px;
}

.page-emoji {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 5px;
  background: #e2d9c8;
  font-size: 11px;
}

.page-emoji.small {
  width: 20px;
  height: 20px;
  font-size: 11px;
}

.page-star {
  color: var(--accent-2);
}

.search-result-row {
  grid-template-columns: 18px minmax(0, 1fr) 14px;
}

.search-result-copy {
  display: grid;
  min-width: 0;
}

.search-result-meta {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-list,
.sidebar-footer {
  color: var(--muted);
  font-size: 13px;
}

.empty-list {
  padding: 6px 8px;
}

.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 8px 2px;
}

.admin-entry {
  display: flex;
  align-items: center;
  gap: 8px;
  width: calc(100% - 6px);
  min-height: 32px;
  margin: 8px 3px 4px;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.admin-entry.selected,
.admin-entry:hover {
  border-color: var(--line-soft);
  background: rgba(255, 253, 249, 0.78);
}

.chat-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
  background: var(--panel);
}

.chat-sidebar,
.chat-app-panel,
.admin-app-panel {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  min-height: 0;
  padding: 10px 8px;
  overflow-y: auto;
}

.chat-sidebar-header {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 6px 12px;
  color: var(--ink);
}

.chat-sidebar-header > div {
  display: grid;
  min-width: 0;
}

.chat-sidebar-header span,
.chat-section-label,
.chat-channel-row em,
.chat-header p,
.chat-message-meta span,
.chat-empty span {
  color: var(--muted);
}

.chat-sidebar-header span,
.chat-section-label,
.chat-channel-row em,
.chat-header p,
.chat-message-meta {
  font-size: 12px;
}

.chat-section-label {
  padding: 14px 8px 4px;
  font-weight: 700;
  text-transform: uppercase;
}

.chat-channel-form {
  display: grid;
  gap: 6px;
  padding: 6px 6px 10px;
}

.chat-channel-form input,
.chat-channel-form select {
  width: 100%;
  min-height: 30px;
  padding: 5px 8px;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  outline: 0;
  background: rgba(255, 253, 249, 0.78);
  color: var(--ink);
  font-size: 12px;
}

.chat-channel-form input:focus,
.chat-channel-form select:focus {
  border-color: rgba(47, 111, 115, 0.42);
  background: #fffdf9;
}

.chat-member-picker {
  display: grid;
  gap: 4px;
  max-height: 116px;
  overflow: auto;
  padding: 2px 0;
}

.chat-member-choice {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  min-height: 26px;
  padding: 3px 4px;
  color: var(--muted);
  font-size: 12px;
}

.chat-member-choice input {
  width: 14px;
  min-height: 14px;
  padding: 0;
}

.chat-channel-form .primary-button {
  justify-content: center;
  min-height: 30px;
  padding-inline: 10px;
  font-size: 12px;
}

.chat-form-caption {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.chat-channel-row {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.chat-channel-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-channel-row.selected,
.chat-channel-row:hover:not(:disabled) {
  border-color: var(--line-soft);
  background: rgba(255, 253, 249, 0.82);
}

.chat-channel-row.disabled {
  opacity: 0.55;
}

.voice-room-item {
  display: grid;
  gap: 3px;
}

.voice-room-row.live {
  color: var(--accent);
}

.voice-room-participants {
  display: grid;
  gap: 2px;
  padding: 0 8px 4px 33px;
}

.voice-room-participant {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 5px;
  min-height: 20px;
  color: var(--muted);
  font-size: 12px;
}

.voice-room-participant span:nth-child(2) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.voice-room-presence-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #9ca3af;
}

.voice-room-presence-dot.local {
  background: var(--accent);
}

.voice-session-bar {
  display: grid;
  gap: 8px;
  margin: 6px 6px 2px;
  padding: 9px;
  border: 1px solid #2f3136;
  border-radius: 8px;
  background: #151619;
  color: #f4f4f5;
}

.voice-session-main {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
}

.voice-session-main > div {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.voice-session-main strong,
.voice-session-main span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.voice-session-main strong {
  color: #f4f4f5;
  font-size: 12px;
}

.voice-session-main span {
  color: #a9adb6;
  font-size: 11px;
}

.voice-session-actions {
  display: grid;
  grid-template-columns: repeat(4, 30px);
  gap: 6px;
}

.voice-session-actions .chat-format-button {
  justify-content: center;
  width: 30px;
  height: 30px;
  min-height: 30px;
  padding: 0;
  border-color: #34373d;
  background: #24272d;
  color: #f4f4f5;
}

.voice-session-actions .chat-format-button:hover,
.voice-session-actions .chat-format-button.active {
  background: #2f5f63;
  color: #ffffff;
}

.voice-session-actions .chat-format-button.danger:hover {
  background: #8f2f3f;
}

.chat-main {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 72px;
  padding: 16px 28px;
  border-bottom: 1px solid var(--line-soft);
}

.chat-title,
.chat-header-actions,
.chat-message-meta,
.chat-message-tags,
.chat-message-actions,
.chat-composer {
  display: flex;
  align-items: center;
}

.chat-title {
  gap: 8px;
}

.chat-title h1,
.chat-header p,
.chat-message-body p {
  margin: 0;
}

.chat-title h1 {
  font-size: 22px;
  line-height: 1.15;
}

.chat-header-actions {
  gap: 6px;
}

.chat-timeline {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 0;
  padding: 18px 26px;
  overflow-y: auto;
}

.chat-message {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  padding: 8px 0;
}

.chat-avatar {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: var(--accent);
  color: white;
  font-size: 13px;
  font-weight: 800;
}

.chat-message-body {
  min-width: 0;
}

.chat-message-meta {
  gap: 8px;
  margin-bottom: 3px;
}

.chat-message-body p,
.chat-message-content {
  color: var(--ink);
  line-height: 1.45;
  white-space: pre-wrap;
}

.chat-message-content.todo {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: start;
  gap: 8px;
}

.chat-message-content.todo input {
  width: 16px;
  height: 16px;
  margin-top: 2px;
  accent-color: var(--accent);
}

.chat-message-content.quote {
  margin: 2px 0 0;
  padding: 2px 0 2px 12px;
  border-left: 3px solid var(--accent);
  color: var(--muted);
}

.chat-message-content.code {
  margin: 3px 0 0;
  padding: 9px 10px;
  overflow-x: auto;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: rgba(29, 27, 24, 0.06);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
}

.chat-message-content.link a {
  display: inline-flex;
  max-width: 100%;
  margin-top: 5px;
  color: var(--accent);
  font-weight: 700;
  overflow-wrap: anywhere;
}

.chat-message-embeds {
  display: grid;
  gap: 7px;
  max-width: 520px;
  margin-top: 8px;
}

.chat-embed-card {
  display: grid;
  gap: 2px;
  padding: 9px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: var(--panel);
  color: var(--ink);
  text-decoration: none;
}

.chat-embed-card:hover {
  border-color: var(--line);
  background: var(--panel-strong);
}

.chat-embed-provider {
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.chat-embed-card strong,
.chat-embed-card small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-embed-card small {
  color: var(--muted);
  font-size: 12px;
}

.chat-message-attachments {
  display: grid;
  gap: 7px;
  max-width: 520px;
  margin-top: 8px;
}

.chat-attachment-card,
.chat-composer-attachment {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: var(--panel);
}

.chat-attachment-meta {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
}

.chat-attachment-meta div,
.chat-composer-attachment span {
  min-width: 0;
}

.chat-attachment-card strong,
.chat-attachment-card small,
.chat-composer-attachment span,
.chat-composer-attachment small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-attachment-card small,
.chat-composer-attachment small {
  color: var(--muted);
  font-size: 12px;
}

.chat-attachment-image {
  grid-column: 1 / -1;
  max-width: 240px;
  max-height: 180px;
  border-radius: 7px;
  object-fit: cover;
}

.chat-attachment-download {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.chat-message-tags,
.chat-message-refs,
.chat-message-reactions,
.chat-message-actions {
  gap: 6px;
  margin-top: 7px;
}

.chat-message-reactions {
  display: flex;
  flex-wrap: wrap;
}

.chat-reaction-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 24px;
  padding: 2px 7px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: var(--panel);
  color: var(--ink);
  font-size: 12px;
}

.chat-reaction-pill.selected {
  border-color: rgba(47, 111, 115, 0.35);
  background: var(--accent-soft);
  color: var(--accent);
}

.chat-reaction-pill strong {
  font-size: 11px;
}

.chat-message-refs {
  display: flex;
  flex-wrap: wrap;
}

.chat-ref-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 240px;
  padding: 2px 7px 2px 4px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: var(--panel);
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.chat-ref-chip span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-message-tags span {
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

.chat-message-actions button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
}

.chat-empty {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 7px;
  min-height: 240px;
  color: var(--muted);
  text-align: center;
}

.chat-empty strong {
  color: var(--ink);
}

.chat-call-window {
  display: grid;
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 80;
  width: min(560px, calc(100vw - 44px));
  max-height: min(620px, calc(100vh - 44px));
  gap: 10px;
  padding: 12px;
  overflow: auto;
  border: 1px solid #2f3136;
  border-radius: 8px;
  background: #151619;
  color: #f4f4f5;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.34);
}

.chat-call-window .chat-call-stage {
  grid-template-columns: minmax(0, 1fr);
}

.chat-call-window .chat-call-media-grid {
  min-height: 126px;
}

.chat-call-window .livekit-media-slot,
.chat-call-window .chat-call-media-empty {
  min-height: 112px;
}

.chat-call-window .chat-call-summary strong,
.chat-call-window .chat-call-summary span,
.chat-call-window .chat-call-media-label {
  color: #f4f4f5;
}

.chat-call-window .chat-call-summary span,
.chat-call-window .chat-call-provider {
  color: #a9adb6;
}

.chat-call-window .chat-call-provider {
  border-color: #30343a;
  background: #202226;
}

.chat-call-window .chat-call-media-grid {
  border-color: #2f3136;
  background: #0f1012;
}

.chat-call-window .icon-button,
.chat-call-window .chat-format-button {
  border-color: #34373d;
  background: #24272d;
  color: #f4f4f5;
}

.chat-call-window .icon-button:hover,
.chat-call-window .chat-format-button:hover,
.chat-call-window .chat-format-button.active {
  background: #2f5f63;
  color: #ffffff;
}

.chat-call-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.chat-call-summary,
.chat-call-actions,
.chat-call-provider {
  display: flex;
  align-items: center;
}

.chat-call-summary {
  gap: 10px;
  min-width: 0;
}

.chat-call-summary > div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.chat-call-summary strong {
  font-size: 13px;
  color: var(--ink);
}

.chat-call-summary span,
.chat-call-provider,
.chat-call-error {
  font-size: 12px;
  color: var(--muted);
}

.chat-call-actions {
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.chat-call-provider {
  gap: 4px;
  padding: 4px 7px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: var(--panel);
  font-weight: 700;
}

.chat-call-error {
  color: var(--danger);
}

.chat-call-stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
}

.chat-call-media-group {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.chat-call-media-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.chat-call-media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
  min-height: 150px;
  padding: 8px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--panel);
}

.livekit-media-slot {
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 9;
  min-width: 0;
  min-height: 132px;
  overflow: hidden;
  border-radius: 6px;
  background: #111;
}

.livekit-media-element {
  width: 100%;
  height: 100%;
  min-width: 0;
  border-radius: 6px;
  background: #111;
  object-fit: cover;
}

audio.livekit-media-element {
  width: 1px;
  height: 1px;
  min-height: 34px;
  background: transparent;
}

.livekit-audio-sinks {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.chat-call-media-empty {
  display: grid;
  place-items: center;
  min-height: 132px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.chat-call-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.video-room-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  height: 100vh;
  min-height: 0;
  overflow: hidden;
  background: #0f1012;
  color: #f4f4f5;
}

.video-room-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 18px;
  background: #151619;
}

.video-room-title {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.video-room-title h1 {
  margin: 0;
  min-width: 0;
  color: #f4f4f5;
  font-size: 16px;
  line-height: 1.1;
}

.video-room-title span {
  color: #a9adb6;
  font-size: 12px;
}

.video-room-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.video-room-action {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid #34373d;
  border-radius: 999px;
  background: #24272d;
  color: #f4f4f5;
  font-size: 13px;
  font-weight: 700;
}

.video-room-action:hover {
  background: #30343a;
}

.video-room-action.primary {
  border-color: #2f6f73;
  background: #2f6f73;
  color: #ffffff;
}

.video-room-action.danger {
  border-color: #7d3030;
  background: #7d3030;
  color: #ffffff;
}

.video-room-stage {
  display: grid;
  min-height: 0;
  padding: 18px;
}

.video-room-stage .chat-call-stage {
  min-height: 0;
}

.video-room-stage .chat-call-media-grid {
  align-content: stretch;
  border-color: #24272d;
  background: #151619;
  min-height: 0;
}

.video-room-stage .chat-call-media-label {
  color: #a9adb6;
}

.video-room-stage .livekit-media-slot,
.video-room-stage .chat-call-media-empty {
  min-height: 320px;
  color: #a9adb6;
}

.video-room-controls {
  display: flex;
  justify-content: center;
  padding: 14px 18px 18px;
  background: #151619;
}

.video-room-controls .chat-call-controls {
  justify-content: center;
}

.video-room-controls .chat-format-button {
  width: 44px;
  height: 44px;
  border-color: #34373d;
  border-radius: 999px;
  background: #24272d;
  color: #f4f4f5;
}

.video-room-controls .chat-format-button:hover,
.video-room-controls .chat-format-button.active {
  background: #2f5f63;
  color: #ffffff;
}

@media (max-width: 820px) {
  .video-room-header {
    flex-direction: column;
  }

  .video-room-header-actions {
    justify-content: flex-start;
  }

  .video-room-stage .chat-call-stage {
    grid-template-columns: 1fr;
  }

  .video-room-stage .livekit-media-slot,
  .video-room-stage .chat-call-media-empty {
    min-height: 210px;
  }
}

.chat-composer {
  display: block;
  padding: 12px 24px 20px;
  border-top: 1px solid var(--line-soft);
  background: var(--panel);
}

.chat-composer-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  overflow: hidden;
}

.chat-composer-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 111, 115, 0.12);
}

.chat-composer textarea {
  width: 100%;
  min-width: 0;
  min-height: 52px;
  max-height: 160px;
  padding: 12px 14px;
  border: none;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
  resize: vertical;
}

.chat-composer textarea:focus {
  border-color: transparent;
  box-shadow: none;
  background: transparent;
}

.chat-composer-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--panel);
  border-top: 1px solid var(--line-soft);
}

.chat-composer-footer-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-composer-footer-right {
  display: flex;
  align-items: center;
}

.chat-format-button {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.chat-format-button:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--ink);
}

.chat-format-button.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.chat-composer-separator {
  width: 1px;
  height: 20px;
  background: var(--line-soft);
  margin: 0 4px;
}

.chat-attach-button {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: var(--panel-strong);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.chat-attach-button:hover {
  background: var(--panel);
  border-color: var(--line);
  color: var(--ink);
}

.chat-attach-button input {
  display: none;
}

.chat-composer-attachment {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--panel);
  border-top: 1px solid var(--line-soft);
  font-size: 13px;
  color: var(--ink);
}

.chat-composer-attachment span {
  font-weight: 500;
}

.chat-composer-attachment small {
  color: var(--muted);
}

.chat-composer-attachment button {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  margin-left: auto;
  transition: all 0.15s ease;
}

.chat-composer-attachment button:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--danger);
}

.chat-composer .primary-button {
  width: 30px;
  height: 30px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border-radius: 6px;
}

.admin-shell {
  display: flex;
  min-height: 0;
  overflow: hidden;
  background: var(--panel);
  width: 100%;
  height: 100%;
}

.admin-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
  padding: 18px 12px;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: #f4efe6;
}

.admin-brand {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}

.admin-brand div:last-child {
  display: grid;
  min-width: 0;
}

.admin-brand span {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 34px;
  padding: 7px 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  text-align: left;
}

.admin-nav-item.selected,
.admin-nav-item:hover {
  border-color: var(--line-soft);
  background: var(--panel);
  color: var(--ink);
}

.admin-back {
  margin-top: auto;
}

.admin-content {
  flex: 1;
  min-width: 0;
  min-height: 0;
  padding: 32px clamp(20px, 4vw, 52px);
  overflow-y: auto;
}

.admin-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.admin-header h1 {
  margin: 0;
  font-size: 32px;
  line-height: 1.08;
}

.admin-header p {
  max-width: 680px;
  margin: 8px 0 0;
  color: var(--muted);
}

.admin-overview {
  display: grid;
  gap: 18px;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.admin-stat-card,
.admin-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
}

.admin-stat-card {
  display: grid;
  gap: 6px;
  padding: 14px;
}

.admin-stat-card svg {
  color: var(--accent);
}

.admin-stat-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.admin-stat-card strong {
  font-size: 26px;
  line-height: 1;
}

.admin-sections {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.admin-section-card {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  min-width: 0;
  min-height: 92px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  color: var(--ink);
  text-align: left;
}

.admin-section-card:hover {
  border-color: #cfc7b9;
  box-shadow: var(--shadow);
}

.admin-section-card.muted {
  color: var(--muted);
}

.admin-section-card strong,
.admin-section-card span {
  display: block;
  min-width: 0;
}

.admin-section-card span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.admin-section-card em,
.status-pill {
  align-self: start;
  padding: 4px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
  white-space: nowrap;
}

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

.admin-panel {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.admin-members-panel {
  gap: 12px;
}

.admin-invite-form,
.admin-token-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(110px, auto) auto;
  gap: 8px;
}

.admin-invite-form input,
.admin-invite-form select,
.admin-token-form input,
.admin-token-form select,
.admin-token-form textarea,
.admin-member-row select {
  min-width: 0;
  min-height: 38px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #fffdf9;
  color: var(--ink);
}

.admin-invite-form input,
.admin-token-form input,
.admin-token-form textarea {
  padding: 0 10px;
}

.admin-token-form textarea {
  min-height: 58px;
  padding-top: 9px;
  resize: vertical;
}

.admin-invite-form select,
.admin-token-form select,
.admin-member-row select {
  padding: 0 8px;
}

.admin-member-list {
  display: grid;
  gap: 8px;
}

.admin-member-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(120px, auto) 32px;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #fffdf9;
}

.admin-member-row strong,
.admin-member-row small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-member-row small {
  color: var(--muted);
  font-size: 12px;
}

.admin-integrations-panel,
.admin-agents-panel,
.admin-operations-panel,
.admin-mail-panel {
  gap: 12px;
}

.admin-token-form {
  grid-template-columns: minmax(180px, 1fr) minmax(180px, auto) auto;
  align-items: center;
}

.admin-token-form.oauth-client-form {
  grid-template-columns: minmax(160px, 0.7fr) minmax(220px, 1fr) auto;
}

.admin-mcp {
  background: var(--panel);
}

.admin-grid.compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.managed-mail-domain {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #fffdf9;
}

.managed-mail-domain-header,
.dns-record-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.managed-mail-domain-header strong,
.managed-mail-domain-header small,
.dns-record-row strong,
.dns-record-row small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.managed-mail-domain-header small,
.dns-record-row small {
  color: var(--muted);
  font-size: 12px;
}

.dns-record-list {
  display: grid;
  gap: 6px;
}

.dns-record-row {
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  padding: 7px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--panel);
}

.operations-summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--panel);
}

.operations-summary strong,
.operations-summary small,
.backup-readiness strong,
.backup-readiness span,
.operation-check-row strong,
.operation-check-row small,
.operation-warning-row strong,
.operation-warning-row small {
  display: block;
  min-width: 0;
}

.operations-summary small,
.backup-readiness span,
.operation-check-row small,
.operation-warning-row small {
  color: var(--muted);
  font-size: 12px;
}

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

.operation-check-row,
.operation-warning-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #fffdf9;
}

.operation-warning-row {
  grid-template-columns: minmax(0, 1fr) auto;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #ede7dc;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.status-badge.ok {
  background: var(--accent-soft);
  color: var(--accent);
}

.status-badge.warning {
  background: #f4ead6;
  color: #8a5d18;
}

.status-badge.degraded,
.status-badge.error {
  background: #f4ded8;
  color: var(--danger);
}

.status-badge.muted {
  background: #ede7dc;
  color: var(--muted);
}

.backup-readiness {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #fffdf9;
}

.admin-denied {
  display: grid;
  place-items: center;
  min-height: 360px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  text-align: center;
}

.admin-denied h2 {
  margin: 8px 0 0;
}

.admin-denied p {
  max-width: 420px;
  margin: 6px 0 0;
  color: var(--muted);
}

.join-code {
  margin: 0 4px;
  padding: 6px 7px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgba(255, 253, 249, 0.66);
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.join-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 30px;
  gap: 4px;
  padding: 0 3px;
}

.join-box input {
  min-width: 0;
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  background: rgba(255, 253, 249, 0.72);
  color: var(--ink);
  font-size: 13px;
}

.import-panel {
  display: grid;
  gap: 8px;
}

.import-file {
  position: relative;
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 9px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
}

.import-file input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.import-textarea {
  width: 100%;
  min-height: 92px;
  resize: vertical;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  background: #fffdf9;
  color: var(--ink);
  font: inherit;
  font-size: 12px;
}

.import-textarea:focus {
  border-color: var(--accent);
}

.import-submit {
  justify-content: center;
  min-height: 34px;
}

.import-warnings {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.editor-shell {
  min-width: 0;
  height: 100%;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--panel);
  scrollbar-gutter: stable;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 10px 22px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(255, 253, 249, 0.92);
  backdrop-filter: blur(16px);
}

.breadcrumb,
.topbar-actions,
.saved-state,
.type-choice {
  display: flex;
  align-items: center;
}

.breadcrumb {
  min-width: 0;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.breadcrumb strong {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page-header-icon {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: var(--line-soft);
  color: var(--ink);
  font-size: 13px;
  line-height: 1;
}

.page-header-icon:disabled {
  cursor: default;
}

.page-header-icon:not(:disabled):hover {
  background: var(--accent-soft);
}

.page-icon-menu {
  position: relative;
  display: inline-grid;
  place-items: center;
}

.emoji-picker {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 20;
  width: min(352px, calc(100vw - 32px));
}

.native-emoji-picker {
  width: 100%;
  height: 420px;
  --background: var(--panel-strong);
  --border-color: var(--line-soft);
  --border-radius: 8px;
  --button-hover-background: var(--accent-soft);
  --button-active-background: var(--accent-soft);
  --category-emoji-padding: 6px;
  --emoji-padding: 6px;
  --indicator-color: var(--accent);
  --input-border-color: var(--line);
  --input-border-radius: 8px;
  --input-font-color: var(--ink);
  --input-placeholder-color: var(--muted);
  --outline-color: var(--accent);
  --skintone-border-radius: 8px;
}

.topbar-actions {
  gap: 6px;
}

.saved-state {
  gap: 6px;
  margin-right: 4px;
  color: var(--muted);
  font-size: 12px;
}

.presence-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 9px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

.public-share-link {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  font-size: 12px;
  text-decoration: none;
  white-space: nowrap;
}

.public-share-link:hover {
  background: var(--panel);
}

.document {
  width: min(100%, 960px);
  margin: 0 auto;
  padding: 34px 32px 88px;
}

.sidebar-closed .document {
  width: min(100%, 1040px);
}

.page-cover {
  position: relative;
  width: min(100%, 1040px);
  height: 172px;
  margin: 0 auto;
  overflow: hidden;
  border-bottom-right-radius: 8px;
  border-bottom-left-radius: 8px;
  background: var(--line-soft);
}

.page-cover-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.page-cover-actions {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: flex;
  gap: 6px;
  opacity: 0;
  transition: opacity 140ms ease;
}

.page-cover:hover .page-cover-actions,
.page-cover:focus-within .page-cover-actions {
  opacity: 1;
}

.page-cover-actions .icon-button {
  background: rgba(255, 253, 249, 0.9);
  box-shadow: var(--shadow);
}

.document-title {
  display: block;
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: clamp(30px, 4.4vw, 46px);
  font-weight: 760;
  letter-spacing: 0;
  line-height: 1.08;
}

.page-tag-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 2px;
}

.page-tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 24px;
  padding: 0 6px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
}

.page-tag-chip:hover {
  background: var(--panel-strong);
  color: var(--ink);
}

.backlinks-panel {
  display: grid;
  gap: 10px;
  margin: 14px 0 0;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #faf8f2;
}

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

.backlinks-header h2 {
  margin: 0;
  font-size: 14px;
  line-height: 1.2;
}

.backlinks-list {
  display: grid;
  gap: 6px;
}

.backlink-card {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 38px;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.unresolved-ref-card {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 30px;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 6px 8px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--panel-strong);
}

.backlink-card:hover {
  border-color: var(--line-soft);
  background: var(--panel-strong);
}

.tag-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 28px;
  padding: 0 8px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
}

.tag-chip:hover {
  background: var(--panel-strong);
}

.tag-chip em {
  color: var(--muted);
  font-style: normal;
}

.comment-thread-list,
.comment-list {
  display: grid;
  gap: 8px;
}

.comment-thread-card {
  display: grid;
  gap: 8px;
  padding: 9px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #fffdf8;
}

.comment-thread-card.resolved {
  opacity: 0.72;
}

.comment-thread-header,
.comment-composer,
.comment-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.comment-thread-header {
  justify-content: space-between;
}

.comment-thread-title,
.comment-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.comment-thread-title {
  min-width: 0;
}

.comment-status {
  min-height: 22px;
  padding: 3px 7px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: capitalize;
}

.comment-row {
  justify-content: space-between;
  min-height: 28px;
  padding: 6px 8px;
  border-radius: 8px;
  background: #faf8f2;
}

.comment-row span {
  color: var(--ink);
}

.comment-row small {
  color: var(--muted);
  white-space: nowrap;
}

.comment-composer input {
  flex: 1;
  min-width: 0;
  width: 100%;
  height: 32px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 0 9px;
  outline: 0;
  background: var(--panel-strong);
  color: var(--ink);
}

.block-comments {
  display: grid;
  grid-column: 3 / 4;
  gap: 8px;
  padding: 2px 4px 8px;
}

.block-comments .comment-composer {
  width: 100%;
}

.comment-composer .auth-switch {
  flex: 0 0 auto;
  width: auto;
  min-height: 32px;
  margin-top: 0;
  padding: 0 9px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--panel-strong);
}

.comment-composer .auth-switch:disabled {
  cursor: default;
  opacity: 0.45;
}

.comment-actions .auth-switch {
  width: auto;
  min-height: 28px;
  margin-top: 0;
  padding: 0 8px;
}

.block-comments .comment-thread-card {
  background: #fffaf0;
}

.automation-panel {
  grid-column: 3 / 4;
  display: inline-flex;
  align-items: center;
  justify-self: start;
  flex-wrap: wrap;
  gap: 8px;
  margin: 2px 0 4px;
}

.automation-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf9;
  color: var(--ink);
  font-weight: 700;
}

.automation-button:hover {
  background: var(--panel-strong);
}

.automation-config {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.backlink-copy {
  display: grid;
  min-width: 0;
}

.backlink-copy strong,
.backlink-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.backlink-copy strong {
  font-size: 13px;
}

.backlink-copy span {
  color: var(--muted);
  font-size: 12px;
}

.database-panel {
  margin-top: 28px;
  border-top: 1px solid var(--line-soft);
  padding-top: 20px;
}

.database-header {
  display: grid;
  grid-template-columns: minmax(220px, 0.85fr) minmax(0, 1.65fr);
  align-items: end;
  gap: 20px;
  margin-bottom: 12px;
}

@media (max-width: 980px) {
  .database-header {
    grid-template-columns: 1fr;
    align-items: start;
    gap: 12px;
  }

  .database-control input,
  .database-control select {
    width: min(168px, calc(100vw - 64px));
  }

  .property-schema-list {
    min-width: 820px;
  }
}

.database-header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: flex-start;
  gap: 8px;
  min-width: 0;
}

.database-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 6px;
}

.database-control {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.database-control input,
.database-control select {
  height: 30px;
  width: 124px;
  max-width: 100%;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 0 8px;
  background: #faf6ee;
  color: var(--ink);
  font-size: 12px;
  font-weight: 500;
}

.database-control input {
  min-width: 0;
  outline: 0;
}

.database-header h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
}

.database-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.database-badge,
.db-relation,
.status-pill {
  display: inline-flex;
  align-items: center;
}

.database-badge {
  gap: 6px;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #faf6ee;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.database-schema-panel {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
  padding: 10px;
  overflow-x: auto;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #faf8f2;
}

.database-schema-header,
.database-schema-actions,
.property-checkbox {
  display: flex;
  align-items: center;
}

.database-schema-header {
  justify-content: space-between;
  gap: 12px;
}

.database-schema-header strong {
  font-size: 13px;
}

.database-schema-actions {
  gap: 6px;
}

.property-schema-list {
  display: grid;
  gap: 6px;
  min-width: 980px;
}

.property-schema-row {
  display: grid;
  grid-template-columns: minmax(130px, 1.05fr) 116px minmax(220px, 1.7fr) 92px minmax(150px, 1.1fr) minmax(110px, 0.8fr) 104px 32px;
  align-items: center;
  gap: 6px;
}

.property-schema-labels {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.property-schema-row.locked {
  opacity: 0.72;
}

.property-schema-row input,
.property-schema-row select {
  width: 100%;
  min-width: 0;
  height: 30px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 0 8px;
  outline: 0;
  background: var(--panel-strong);
  color: var(--ink);
  font-size: 12px;
}

.property-schema-row input:disabled,
.property-schema-row select:disabled {
  background: #f0ebe2;
  color: var(--muted);
}

.property-inline-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  min-width: 0;
}

.property-inline-controls.single {
  grid-template-columns: minmax(0, 1fr);
}

.property-checkbox {
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.property-checkbox input {
  width: 14px;
  height: 14px;
  padding: 0;
}

.property-lock {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
}

.property-empty {
  min-width: 0;
}

.property-feedback {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  min-width: 0;
  padding: 0 8px;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: #f0ebe2;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.property-feedback:empty {
  visibility: hidden;
}

.property-feedback.ok {
  border-color: #c7ded8;
  background: #e7f3ef;
  color: #2f6d65;
}

.property-feedback.error {
  border-color: #ead1c6;
  background: #f6e8df;
  color: #985d3f;
}

.property-feedback.info {
  border-color: #d8d2c5;
  background: #f5f0e8;
  color: var(--muted);
}

.database-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--panel-strong);
}

.database-board {
  display: grid;
  grid-auto-columns: minmax(210px, 1fr);
  grid-auto-flow: column;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.board-column {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 160px;
  padding: 8px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #faf8f2;
}

.board-column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 26px;
}

.board-column-header strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.board-cards {
  display: grid;
  gap: 7px;
}

.board-card {
  display: grid;
  gap: 7px;
  width: 100%;
  min-height: 76px;
  padding: 9px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--panel-strong);
  color: var(--ink);
  text-align: left;
}

.board-card:hover {
  border-color: rgba(47, 111, 115, 0.26);
}

.board-card strong {
  overflow: hidden;
  font-size: 13px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.board-card-page {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
}

.board-card-meta {
  overflow: hidden;
  color: var(--accent-2);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.database-list-layout,
.database-gallery-layout,
.database-calendar-layout,
.database-timeline-layout {
  display: grid;
  gap: 8px;
}

.database-gallery-layout {
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

.database-gallery-layout .board-card {
  min-height: 116px;
}

.calendar-day {
  display: grid;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #faf8f2;
}

.calendar-day > strong {
  color: var(--muted);
  font-size: 12px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
}

.timeline-date {
  padding-top: 9px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.database-table {
  width: 100%;
  min-width: 820px;
  border-collapse: collapse;
  table-layout: fixed;
}

.database-table th,
.database-table td {
  height: 40px;
  padding: 7px 10px;
  border-bottom: 1px solid var(--line-soft);
  border-right: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: middle;
}

.database-table th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.database-table tr:last-child td {
  border-bottom: 0;
}

.database-group-row td {
  height: 32px;
  padding: 6px 10px;
  background: #f7f1e7;
}

.database-group-label,
.database-group-count {
  display: inline-flex;
  align-items: center;
}

.database-group-label {
  color: var(--ink);
  font-size: 12px;
  font-weight: 760;
}

.database-group-count {
  margin-left: 8px;
  color: var(--muted);
  font-size: 12px;
}

.database-table th:last-child,
.database-table td:last-child {
  border-right: 0;
}

.db-title-cell {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.db-relation {
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
}

.status-pill {
  min-height: 24px;
  padding: 0 8px;
  border-radius: 8px;
  background: #eee8dc;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.status-pill.done {
  background: var(--accent-soft);
  color: var(--accent);
}

.status-pill.todo {
  background: #f3e7df;
  color: var(--accent-2);
}

.db-cell-input,
.db-cell-select {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.db-cell-select {
  height: 28px;
  border: 1px solid transparent;
  border-radius: 6px;
}

.db-cell-select:focus {
  border-color: var(--line);
  background: var(--panel-strong);
}

.blocks {
  display: grid;
  gap: 2px;
}

.add-block-row {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  gap: 8px;
  min-height: 34px;
  margin: 8px 0 18px 42px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
}

.add-block-row:hover,
.add-block-row:focus-visible {
  border-color: var(--line-soft);
  background: #faf7f0;
  color: var(--ink);
}

.block {
  position: relative;
  display: grid;
  grid-template-columns: 26px 10px minmax(0, 1fr) 0;
  align-items: start;
  gap: 6px;
  min-height: 36px;
  border-radius: 8px;
}

.block-tree-line {
  width: 10px;
  height: 1px;
  margin-top: 18px;
  background: var(--line);
}

.block-tree-line.empty {
  background: transparent;
}

.block:hover {
  background: #faf7f0;
}

.block.focused {
  background: #fff4c7;
  box-shadow: inset 3px 0 0 var(--accent);
}

.block.dragging {
  opacity: 0.48;
}

.block.drag-over {
  box-shadow: inset 0 -2px 0 var(--accent);
}

.block:hover .block-menu,
.block:focus-within .block-menu {
  opacity: 1;
  pointer-events: auto;
}

.block-handle {
  display: grid;
  place-items: center;
  width: 26px;
  height: 36px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: transparent;
  cursor: grab;
}

.block-handle:active {
  cursor: grabbing;
}

.block:hover .block-handle,
.block-handle:focus-visible {
  color: #a7a095;
}

.block-input {
  display: block;
  grid-column: 3 / 4;
  width: 100%;
  min-width: 0;
  min-height: 36px;
  padding: 6px 4px;
  resize: none;
  overflow: hidden;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  line-height: 1.55;
}

.rich-text-preview {
  grid-column: 3 / 4;
  min-height: 30px;
  padding: 5px 4px 8px;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.rich-text-span.mark-bold {
  font-weight: 750;
}

.rich-text-span.mark-italic {
  font-style: italic;
}

.rich-text-span.mark-code {
  padding: 1px 4px;
  border-radius: 5px;
  background: #eee8dc;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.92em;
}

.rich-text-span.mark-strike {
  text-decoration: line-through;
}

.rich-text-span.mark-ref {
  color: var(--accent);
  font-weight: 650;
}

.rich-text-preview a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.attachment-preview {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  grid-column: 3 / 4;
  min-height: 34px;
  padding: 7px 9px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #faf8f2;
  color: var(--muted);
  font-size: 13px;
}

.attachment-preview span {
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-preview small {
  font-size: 11px;
}

.attachment-upload {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 8px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--panel-strong);
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
}

.attachment-upload input {
  display: none;
}

.image-preview {
  grid-template-columns: 18px minmax(0, 1fr) auto;
}

.image-preview img {
  grid-column: 1 / -1;
  max-width: 100%;
  max-height: 220px;
  border-radius: 8px;
  object-fit: cover;
}

.block.h1 .block-input {
  min-height: 48px;
  font-size: 28px;
  font-weight: 750;
  line-height: 1.24;
}

.checkbox {
  position: relative;
  display: block;
  width: 18px;
  height: 18px;
  margin: 9px 0 0 4px;
  padding: 0;
  border: 1px solid #bdb5a7;
  border-radius: 5px;
  background: #fffdf9;
  color: #ffffff;
  line-height: 1;
}

.checkbox.checked {
  border-color: var(--accent);
  background: var(--accent);
}

.checkbox.checked::before {
  content: "✓";
  position: absolute;
  left: 50%;
  top: 50%;
  color: #ffffff;
  font-size: 15px;
  font-weight: 750;
  line-height: 1;
  transform: translate(-50%, -53%);
}

.block.todo {
  grid-template-columns: 26px 10px 24px minmax(0, 1fr) 0;
}

.block.todo .block-input,
.block.todo .rich-text-preview,
.block.todo .attachment-preview,
.block.todo .automation-panel,
.block.todo .block-comments {
  grid-column: 4 / 5;
}

.block.todo .block-menu {
  left: 66px;
}

.bullet-dot {
  width: 6px;
  height: 6px;
  margin: 15px 8px 0 10px;
  border-radius: 50%;
  background: var(--ink);
}

.block.bulleted {
  grid-template-columns: 26px 10px 24px minmax(0, 1fr) 0;
}

.block.bulleted .block-input,
.block.bulleted .rich-text-preview,
.block.bulleted .attachment-preview,
.block.bulleted .automation-panel,
.block.bulleted .block-comments {
  grid-column: 4 / 5;
}

.quote-line {
  width: 3px;
  min-height: 28px;
  margin: 5px 8px 0 10px;
  border-radius: 2px;
  background: var(--accent-2);
}

.block.quote {
  grid-template-columns: 26px 10px 24px minmax(0, 1fr) 0;
}

.block.quote .block-input,
.block.quote .rich-text-preview,
.block.quote .attachment-preview,
.block.quote .automation-panel,
.block.quote .block-comments {
  grid-column: 4 / 5;
}

.block.quote .block-input {
  color: #4d4338;
  font-style: italic;
}

.block-menu {
  position: absolute;
  z-index: 5;
  top: -38px;
  left: 28px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease;
}

.slash-menu {
  position: absolute;
  top: 36px;
  left: 32px;
  z-index: 4;
  max-width: calc(100vw - 48px);
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  box-shadow: var(--shadow);
  overflow-x: auto;
}

.type-picker {
  display: flex;
  gap: 2px;
}

.slash-empty {
  min-width: 150px;
  padding: 6px 8px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.type-choice {
  gap: 5px;
  min-height: 28px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
}

.type-choice:hover,
.type-choice.selected {
  border-color: var(--line-soft);
  background: var(--accent-soft);
  color: var(--accent);
}

.empty-state {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
  min-height: 100vh;
  color: var(--muted);
}

.empty-state h1 {
  margin: 0;
  color: var(--ink);
}

.auth-shell {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
  background: var(--bg);
}

.auth-panel {
  width: min(420px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.auth-mark {
  margin-bottom: 18px;
}

.auth-panel h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.15;
}

.auth-panel p {
  margin: 10px 0 22px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.auth-field {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.auth-field input {
  width: 100%;
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  background: #fffdf9;
  color: var(--ink);
  font-weight: 400;
}

.auth-field input:focus {
  border-color: var(--accent);
}

.auth-error {
  margin: 8px 0 12px;
  color: var(--danger);
  font-size: 13px;
}

.auth-submit {
  width: 100%;
  justify-content: center;
  margin-top: 4px;
}

.auth-switch {
  width: 100%;
  min-height: 36px;
  margin-top: 10px;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-weight: 700;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 14px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 700;
}

.primary-button:disabled {
  cursor: default;
  opacity: 0.62;
}

.secondary-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font-weight: 700;
}

.secondary-button:disabled {
  cursor: default;
  color: var(--muted);
  opacity: 0.7;
}

/* Video App */
.video-sidebar-panel {
  gap: 6px;
}

.video-recording-row {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 7px;
  width: 100%;
  min-height: 52px;
  padding: 7px 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.video-recording-row:hover,
.video-recording-row.selected {
  border-color: var(--line-soft);
  background: #fffdf9;
}

.video-row-icon {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: #e4f1ef;
  color: var(--accent);
}

.video-row-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.video-row-copy strong,
.video-row-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.video-row-copy strong {
  font-size: 13px;
}

.video-row-copy span,
.video-projection-note {
  color: var(--muted);
  font-size: 11px;
}

.video-row-selected {
  color: var(--accent);
}

.video-projection-note {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  gap: 7px;
  margin: 6px 2px 0;
  padding: 9px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgba(255, 253, 249, 0.72);
  line-height: 1.35;
}

.video-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #fbfbfb;
}

.video-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line-soft);
  background: #ffffff;
}

.video-header h1,
.video-panel h2 {
  margin: 0;
  color: var(--ink);
}

.video-header h1 {
  font-size: 20px;
  font-weight: 750;
}

.video-header p {
  max-width: 760px;
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.video-header-actions {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 8px;
}

.video-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 32%);
  gap: 14px;
  min-width: 0;
  min-height: 0;
  padding: 14px;
  overflow: hidden;
}

.video-primary,
.video-inspector {
  display: grid;
  align-content: start;
  gap: 14px;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
}

.video-player-panel,
.video-panel {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #ffffff;
}

.video-player-frame {
  aspect-ratio: 16 / 9;
  min-height: 260px;
  max-height: 58vh;
  overflow: hidden;
  border-radius: 8px 8px 0 0;
  background: #171717;
}

.video-player-frame video,
.video-player-empty {
  width: 100%;
  height: 100%;
}

.video-player-frame video {
  display: block;
  object-fit: contain;
  background: #171717;
}

.video-player-empty {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  color: #fffdf9;
}

.video-player-empty span {
  color: rgba(255, 253, 249, 0.72);
  font-size: 13px;
}

.video-metadata-strip,
.video-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
}

.video-metadata-strip {
  justify-content: flex-start;
  flex-wrap: wrap;
  border-top: 1px solid var(--line-soft);
}

.video-metadata-pill,
.video-ref-pill,
.video-tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #f6f3ee;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.video-panel {
  overflow: hidden;
}

.video-panel-header {
  min-height: 46px;
  border-bottom: 1px solid var(--line-soft);
}

.video-panel-header h2 {
  font-size: 14px;
  font-weight: 750;
}

.video-panel-header span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.video-transcript-list,
.video-chapter-list,
.video-ref-list {
  display: grid;
}

.video-transcript-cue {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid var(--line-soft);
}

.video-transcript-cue:last-child,
.video-chapter-row:last-child {
  border-bottom: 0;
}

.video-cue-time,
.video-timecode {
  color: var(--accent);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.video-cue-body {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.video-cue-speaker {
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.video-cue-body p {
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.45;
}

.video-ref-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 12px;
}

.video-cue-body .video-ref-list {
  padding: 0;
}

.video-ref-pill {
  max-width: 100%;
  overflow: hidden;
  color: var(--accent);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.video-tag-pill {
  color: var(--accent-2);
}

.video-chapter-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 28px;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 42px;
  padding: 8px 12px;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.video-chapter-row:hover {
  background: #fbf8f2;
}

.video-chapter-title {
  overflow: hidden;
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.video-chapter-refs {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #e4f1ef;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
}

.video-empty-panel {
  padding: 14px 12px;
  color: var(--muted);
  font-size: 13px;
}

.empty-video-shell {
  place-items: center;
  align-content: center;
  gap: 8px;
  color: var(--muted);
}

.empty-video-shell h1 {
  margin: 0;
  color: var(--ink);
}

/* Mail Styles */
.calendar-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 380px);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #fbfbfb;
}

.calendar-week-view {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.calendar-week-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 74px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line-soft);
  background: #fff;
}

.calendar-week-header h1 {
  margin: 0;
  color: var(--ink);
  font-size: 20px;
  font-weight: 760;
}

.calendar-week-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(132px, 1fr));
  min-width: 0;
  min-height: 0;
  overflow-x: auto;
  overflow-y: hidden;
  background: #fffdf9;
}

.calendar-day-column {
  display: grid;
  align-content: start;
  gap: 8px;
  min-width: 132px;
  min-height: 0;
  padding: 12px;
  border-right: 1px solid var(--line-soft);
  overflow-y: auto;
}

.calendar-day-column header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  min-height: 32px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
}

.calendar-day-column header strong {
  color: var(--ink);
  font-size: 13px;
  text-transform: none;
}

.calendar-event-row {
  display: grid;
  gap: 5px;
  width: 100%;
  min-height: 84px;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  text-align: left;
}

.calendar-event-row:hover,
.calendar-event-row.selected {
  border-color: rgba(47, 111, 115, 0.28);
  background: rgba(47, 111, 115, 0.07);
}

.calendar-event-row time,
.calendar-event-row span {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-event-row strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  font-weight: 760;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-event-row em {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: fit-content;
  color: #2f6f73;
  font-size: 11px;
  font-style: normal;
  font-weight: 760;
}

.calendar-empty-day {
  padding: 10px 0;
  color: var(--muted);
  font-size: 12px;
}

.calendar-event-panel {
  display: grid;
  align-content: start;
  gap: 12px;
  min-width: 0;
  min-height: 0;
  padding: 18px;
  border-left: 1px solid var(--line-soft);
  overflow-y: auto;
  background: #ffffff;
}

.calendar-event-panel > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.calendar-event-panel h2 {
  margin: 0;
  color: var(--ink);
  font-size: 18px;
  font-weight: 760;
}

.calendar-field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
}

.calendar-field input,
.calendar-field textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #fffdf9;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
}

.calendar-field input {
  height: 38px;
  padding: 0 10px;
}

.calendar-field textarea {
  min-height: 92px;
  padding: 10px;
  resize: vertical;
}

.calendar-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 720;
}

.calendar-members {
  display: grid;
  gap: 7px;
}

.calendar-members > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
}

.calendar-member-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  color: var(--ink);
  font-size: 13px;
}

.calendar-member-option span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-member-option em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}

.calendar-panel-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 4px;
}

.mail-shell {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #fbfbfb;
}

.mail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line-soft);
  background: white;
}

.mail-header h1 {
  margin: 0;
  color: var(--ink);
  font-size: 20px;
  font-weight: 750;
}

.mail-header-actions,
.mail-thread-actions,
.mail-draft-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mail-connection-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 24px;
  border-bottom: 1px solid var(--line-soft);
  background: #fffdf9;
}

.mail-connection-strip > div {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.mail-workspace {
  display: grid;
  grid-template-columns: minmax(280px, 36%) minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
}

.mail-error {
  padding: 10px 24px;
  border-bottom: 1px solid rgba(174, 55, 55, 0.18);
  background: rgba(174, 55, 55, 0.06);
  color: var(--danger);
  font-size: 13px;
  font-weight: 700;
}

.mail-thread-list {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  border-right: 1px solid var(--line-soft);
  background: #ffffff;
}

.mail-list-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line-soft);
}

.mail-list-toolbar > div {
  display: grid;
  gap: 2px;
}

.mail-list-toolbar strong {
  color: var(--ink);
  font-size: 14px;
}

.mail-list-toolbar span {
  color: var(--muted);
  font-size: 12px;
}

.mail-thread-scroll {
  min-height: 0;
  overflow-y: auto;
}

.mail-thread-row {
  display: grid;
  gap: 7px;
  width: 100%;
  padding: 14px 16px;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  background: transparent;
  text-align: left;
  color: var(--ink);
}

.mail-thread-row:hover,
.mail-thread-row.selected {
  background: var(--panel);
}

.mail-thread-row.unread strong {
  font-weight: 800;
}

.mail-thread-row-top,
.mail-thread-row-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.mail-thread-row-top strong,
.mail-thread-row-meta span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mail-thread-row-top span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
}

.mail-thread-row-meta {
  color: var(--muted);
  font-size: 12px;
}

.mail-thread-row-meta em {
  flex: 0 0 auto;
  color: #2f6f73;
  font-size: 11px;
  font-style: normal;
  font-weight: 750;
}

.mail-thread-row p {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.mail-thread-pane {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
  background: #fbfbfb;
}

.mail-thread-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line-soft);
  background: white;
}

.mail-thread-header h1 {
  margin: 0;
  color: var(--ink);
  font-size: 18px;
  line-height: 1.25;
}

.mail-thread-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.mail-context-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  border-bottom: 1px solid var(--line-soft);
  background: #ffffff;
}

.mail-context-bar span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.mail-triage-control {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 24px 18px;
}

.mail-triage-option {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.mail-triage-option:hover,
.mail-triage-option.active {
  border-color: rgba(42, 125, 130, 0.28);
  background: rgba(42, 125, 130, 0.1);
  color: var(--accent-strong);
}

.mail-triage-option:disabled {
  cursor: default;
  opacity: 0.7;
}

.mail-page-link-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 0 24px 18px;
}

.mail-page-link-control select {
  min-height: 38px;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 10px;
  font: inherit;
  font-size: 13px;
}

.mail-message-stack {
  display: grid;
  align-content: start;
  gap: 12px;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 24px;
}

.mail-message {
  display: grid;
  gap: 12px;
  max-width: 760px;
  padding: 16px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: white;
}

.mail-message header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.mail-avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #2f6f73;
  color: #ffffff;
  font-weight: 800;
}

.mail-message header > div:nth-child(2) {
  display: grid;
  gap: 2px;
}

.mail-message header strong {
  color: var(--ink);
  font-size: 13px;
}

.mail-message header span,
.mail-message time {
  color: var(--muted);
  font-size: 12px;
}

.mail-message p {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
}

.mail-draft-bar {
  justify-content: flex-end;
  padding: 12px 24px;
  border-top: 1px solid var(--line-soft);
  background: white;
}

@media (max-width: 680px) {
  body {
    height: auto;
    overflow: auto;
  }

  #app {
    height: auto;
    min-height: 100vh;
  }

  .app-frame {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

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

  .mail-thread-list {
    min-height: 260px;
    border-right: 0;
    border-bottom: 1px solid var(--line-soft);
  }

  .mail-thread-pane {
    min-height: 460px;
  }

  .sidebar {
    grid-template-columns: 54px minmax(0, 1fr);
    width: 100%;
    height: auto;
    max-height: 48vh;
    min-height: auto;
    overflow: hidden;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .app-rail {
    max-height: 48vh;
    overflow-y: auto;
  }

  .sidebar-panel {
    max-height: 48vh;
  }

  .workspace-switcher {
    grid-template-columns: minmax(0, 1fr);
  }

  .editor-shell {
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  .admin-shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .chat-shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .chat-main {
    min-height: 60vh;
    overflow: visible;
  }

  .chat-header,
  .chat-composer {
    padding-inline: 16px;
  }

  .chat-timeline {
    padding-inline: 16px;
  }

  .admin-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    height: auto;
    overflow: visible;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .admin-brand {
    grid-column: 1 / -1;
  }

  .admin-back {
    margin-top: 0;
  }

  .admin-content {
    overflow: visible;
  }

  .admin-header {
    align-items: stretch;
  }

  .admin-stats,
  .admin-sections,
  .admin-grid,
  .admin-grid.compact,
  .operations-grid,
  .admin-invite-form,
  .admin-token-form,
  .admin-member-row,
  .managed-mail-domain-header,
  .dns-record-row {
    grid-template-columns: 1fr;
  }

  .topbar {
    grid-template-columns: 36px minmax(0, 1fr);
  }

  .topbar-actions {
    display: none;
  }

  .document,
  .sidebar-closed .document {
    width: min(100%, 760px);
    padding: 30px 16px 82px;
  }

  .document-title {
    font-size: 32px;
  }

  .block-menu {
    left: 0;
    width: 100%;
    max-width: 100%;
    flex-wrap: wrap;
    overflow-x: hidden;
  }

  .block.todo .block-menu {
    left: 0;
  }

  .block.bulleted .block-menu,
  .block.quote .block-menu {
    left: 0;
  }

  .database-control {
    width: 100%;
  }

  .database-control input,
  .database-control select {
    width: 100%;
  }

  .database-badge {
    min-height: 28px;
  }

  .property-schema-list {
    min-width: 760px;
  }
}

/* Chat Threads */
.chat-shell.with-thread {
  grid-template-columns: minmax(0, 1fr) 380px;
}

.chat-thread-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border-left: 1px solid var(--line-soft);
  background: var(--panel-strong);
}

.chat-thread-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 72px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line-soft);
}

.chat-thread-header h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}

.chat-thread-timeline {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 0;
  padding: 18px 20px;
  overflow-y: auto;
}

.chat-thread-timeline .chat-message {
  padding: 6px 0;
}

.chat-thread-divider {
  display: flex;
  align-items: center;
  margin: 14px 0 10px;
}

.chat-thread-divider::before,
.chat-thread-divider::after {
  content: "";
  flex: 1;
  border-bottom: 1px solid var(--line-soft);
}

.chat-thread-divider span {
  padding: 0 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  white-space: nowrap;
}

.chat-message-thread-summary {
  margin-top: 6px;
}

.chat-message-thread-summary button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  padding: 2px 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  transition: all 0.15s ease;
}

.chat-message-thread-summary button:hover {
  background: rgba(47, 111, 115, 0.2);
}

.unread-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #2f6f73;
  color: white;
  border-radius: 9999px;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  min-width: 15px;
  height: 15px;
  line-height: 1;
}

.chat-channel-row.unread span {
  font-weight: 700;
}

/* Inbox Styles */
.inbox-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #fbfbfb;
}

.inbox-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line-soft);
  background: white;
}

.inbox-header h1 {
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
}

.inbox-timeline {
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
}

.inbox-item-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 16px;
  padding: 16px;
  background: white;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
  transition: all 0.2s ease;
  text-align: left;
  cursor: pointer;
  width: 100%;
}

.inbox-item-card:hover {
  border-color: #2f6f73;
  box-shadow: 0 4px 12px rgba(0,0,0,0.04);
  transform: translateY(-1px);
}

.inbox-item-card.read {
  opacity: 0.75;
  background: #fafafa;
}

.inbox-item-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--line-soft);
  color: var(--ink);
}

.inbox-item-card:not(.read) .inbox-item-icon {
  background: rgba(47, 111, 115, 0.1);
  color: #2f6f73;
}

.inbox-item-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.inbox-item-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.inbox-item-excerpt {
  font-size: 13px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.inbox-item-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
}

.inbox-item-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 9999px;
  background: #2f6f73;
}

.inbox-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 64px 24px;
  text-align: center;
  color: var(--muted);
  gap: 12px;
}

.inbox-empty strong {
  color: var(--ink);
  font-size: 16px;
}

/* Slack-style Sidebar Section Header & Add Channel Row */
.chat-section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding-right: 8px;
}

.chat-section-header .icon-button {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--muted);
  border: none;
  margin-bottom: 2px;
}

.chat-section-header .icon-button:hover {
  background: var(--line-soft);
  color: var(--ink);
}

.chat-add-channel-row {
  color: var(--muted);
}

.chat-add-channel-row span {
  font-weight: 500;
}

/* Modal Dialog Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.15s ease-out;
}

.modal-container {
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 12px;
  width: 520px;
  max-width: 90%;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.2s ease-out;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 24px 28px 16px;
  border-bottom: 1px solid var(--line-soft);
}

.modal-header h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
}

.modal-subtitle {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
}

.modal-header .close-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.1s;
}

.modal-header .close-btn:hover {
  background: var(--bg);
  color: var(--ink);
}

.modal-body {
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-height: 60vh;
  overflow-y: auto;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 28px;
  background: var(--bg);
  border-top: 1px solid var(--line-soft);
}

/* Form elements inside modal */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.form-group label .optional {
  font-weight: 400;
  color: var(--muted);
}

.form-group input[type="text"] {
  width: 100%;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  font-size: 14px;
  color: var(--ink);
  background: #ffffff;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-group input[type="text"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 111, 115, 0.12);
}

.channel-name-input-wrapper {
  display: flex;
  align-items: center;
  position: relative;
  width: 100%;
}

.channel-name-input-wrapper .hash-prefix {
  position: absolute;
  left: 12px;
  color: var(--muted);
  font-size: 16px;
  font-weight: 500;
  pointer-events: none;
}

.channel-name-input-wrapper input {
  padding-left: 28px !important;
}

/* Switch Toggle */
.privacy-group {
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 8px 0;
}

.privacy-toggle-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 80%;
}

.privacy-toggle-label label {
  margin: 0;
}

.privacy-description {
  font-size: 12px;
  color: var(--muted);
  font-weight: 400;
  line-height: 1.4;
}

.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--line);
  transition: .3s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

input:checked + .slider {
  background-color: var(--accent);
}

input:focus + .slider {
  box-shadow: 0 0 1px var(--accent);
}

input:checked + .slider:before {
  transform: translateX(20px);
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { transform: translateY(12px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Settings Dropdown and Popover styles */
.app-rail-settings-container {
  position: relative;
  display: inline-block;
}

.settings-dropdown {
  position: absolute;
  bottom: 0;
  left: 48px;
  width: 220px;
  background: var(--panel-strong, #fffdf9);
  border: 1px solid var(--line, #e6e3dd);
  border-radius: 8px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.08);
  padding: 6px 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.15s ease-out;
}

.dropdown-header {
  padding: 10px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dropdown-header strong {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropdown-sub {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropdown-divider {
  height: 1px;
  background-color: var(--line-soft);
  margin: 6px 0;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 14px;
  border: none;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
}

.dropdown-item:hover {
  background-color: var(--bg, #f6f3ee);
  color: var(--accent);
}

.dropdown-item svg {
  color: var(--muted);
  flex-shrink: 0;
  transition: color 0.1s;
}

.dropdown-item:hover svg {
  color: var(--accent);
}

.dropdown-item.danger {
  color: #c92a2a;
}

.dropdown-item.danger:hover {
  background-color: #fff5f5;
  color: #c92a2a;
}

.dropdown-item.danger svg {
  color: #c92a2a;
}
