/* ==========================================================================
   Sender workspace (index.html). Requires base.css.
   ========================================================================== */

html,
body {
  height: 100%;
}

body {
  overflow: hidden;
}

body.no-scroll {
  overflow: hidden;
}

.container {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
}

/* ---------- Sidebar ---------- */
.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg-subtle);
  border-right: 1px solid var(--border);
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: 60px;
  padding: 0 12px 0 16px;
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 4px;
  margin-left: -4px;
  border-radius: var(--radius-sm);
}

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  flex-shrink: 0;
  box-shadow: var(--shadow-xs);
}

.brand-text {
  display: grid;
  min-width: 0;
  line-height: 1.2;
}

.chat-title {
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  white-space: nowrap;
}

.brand-sub {
  font-size: 0.75rem;
  color: var(--text-subtle);
}

.sidebar-close-btn {
  display: none;
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 1.375rem;
  line-height: 1;
}

.sidebar-close-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.new-message-area {
  padding: 4px 16px 12px;
  flex-shrink: 0;
}

.new-message-button {
  width: 100%;
  height: 38px;
}

.search {
  position: relative;
  padding: 0 16px 12px;
  flex-shrink: 0;
}

.search i {
  position: absolute;
  left: 28px;
  top: 12px;
  font-size: 0.8125rem;
  color: var(--text-subtle);
  pointer-events: none;
}

.search input {
  width: 100%;
  height: 36px;
  padding: 0 12px 0 34px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 0.84375rem;
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}

.search input::placeholder {
  color: var(--text-subtle);
}

.search input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

.sidebar-section-label {
  display: flex;
  justify-content: space-between;
  padding: 8px 20px 6px;
  flex-shrink: 0;
}

.conversations {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0 8px 16px;
  display: grid;
  align-content: start;
  gap: 2px;
  scrollbar-width: thin;
}

.conversations:empty::after {
  content: attr(data-empty);
  display: block;
  padding: 24px 12px;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--text-subtle);
}

.conversation {
  position: relative;
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease);
}

.conversation:hover {
  background: var(--surface-hover);
}

.conversation.active {
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.conversation.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}

.conversation-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.contact-name {
  min-width: 0;
  font-size: 0.84375rem;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-date {
  flex-shrink: 0;
  font-size: 0.75rem;
  color: var(--text-subtle);
  font-variant-numeric: tabular-nums;
}

.message-preview {
  font-size: 0.8125rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-dates {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 8px;
  min-width: 0;
  margin-top: 4px;
  font-size: 0.75rem;
  color: var(--text-subtle);
  font-variant-numeric: tabular-nums;
}

.message-dates .badge {
  height: 20px;
  font-size: 0.71875rem;
}

.sidebar-backdrop {
  display: none;
}

/* ---------- Main column ---------- */
.main-container {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--bg);
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 60px;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  flex-shrink: 0;
}

#title-div {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  overflow: hidden;
}

.sidebar-toggle {
  display: none;
}

.shield-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 0.8125rem;
}

.topbar-title {
  display: grid;
  line-height: 1.25;
  min-width: 0;
}

.topbar-title strong {
  font-size: 0.84375rem;
  white-space: nowrap;
}

.topbar-title span {
  font-size: 0.75rem;
  color: var(--text-subtle);
  white-space: nowrap;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.home-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: var(--control-h);
  padding: 0 10px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-weight: 500;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}

.home-link:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.home-link.is-current {
  color: var(--text);
  background: var(--surface-hover);
}

.topbar-divider {
  width: 1px;
  height: 20px;
  margin: 0 8px;
  background: var(--border);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 0 4px;
}

.user-email {
  max-width: 220px;
  font-size: 0.8125rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-pic {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.logout-button {
  margin-left: 4px;
}

/* Scrolling content areas. JS toggles display:flex / none on both. */
.chat-window,
#historyContainer {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 32px 32px 64px;
  scrollbar-gutter: stable;
}

.chat-window > *,
#historyContainer > * {
  min-width: 0;
  width: 100%;
  max-width: 960px;
  margin-left: auto;
  margin-right: auto;
}

.chat-window > p {
  padding: 64px 16px;
  text-align: center;
  color: var(--text-muted);
}

/* ---------- Welcome ---------- */
.welcome-panel {
  display: grid;
  gap: 32px;
  padding-top: 24px;
}

.welcome-hero {
  display: grid;
  gap: 12px;
  max-width: 640px;
}

.welcome-hero h1 {
  font-size: 1.75rem;
  letter-spacing: -0.025em;
}

.welcome-hero .lead {
  font-size: 0.9375rem;
  color: var(--text-muted);
  max-width: 560px;
}

.welcome-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.feature-item {
  display: grid;
  align-content: start;
  gap: 6px;
  padding: 20px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.feature-item:nth-child(3n) {
  border-right: 0;
}

.feature-item:nth-last-child(-n + 3) {
  border-bottom: 0;
}

.feature-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin-bottom: 6px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 0.875rem;
}

.feature-item strong {
  font-size: 0.875rem;
}

.feature-item p {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.welcome-note {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.78125rem;
  color: var(--text-subtle);
}

/* ---------- Page heads ---------- */
.page-head {
  display: grid;
  gap: 4px;
  margin-bottom: 24px;
}

.page-head h1 {
  font-size: 1.375rem;
  letter-spacing: -0.02em;
}

.page-head p {
  color: var(--text-muted);
}

/* ---------- Message detail ---------- */
.detail-view {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
}

.detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.detail-heading {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.detail-title {
  font-size: 1.375rem;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 16px;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.meta-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-variant-numeric: tabular-nums;
}

.meta-item i {
  color: var(--text-subtle);
  font-size: 0.75rem;
}

.meta-item strong {
  font-weight: 500;
  color: var(--text);
}

.conversation-detail-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

/* Reply / Reply all are injected by reply-feature.js — show them first. */
.reply-button-container {
  order: -1;
  display: inline-flex !important;
  gap: 8px !important;
  padding-right: 8px;
  margin-right: 0;
  border-right: 1px solid var(--border);
}

#replyBtn {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}

#replyBtn:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.detail-grid {
  display: grid;
  gap: 12px;
}

.detail-block {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  align-items: baseline;
  gap: 12px;
}

.detail-label {
  font-size: 0.78125rem;
  font-weight: 500;
  color: var(--text-subtle);
}

.detail-value {
  font-size: 0.875rem;
  color: var(--text);
  overflow-wrap: anywhere;
}

.conversation-editor-wrapper {
  display: grid;
  gap: 8px;
}

.detail-section {
  display: grid;
  gap: 10px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.section-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-head h2,
.section-title {
  font-size: 0.84375rem;
  font-weight: 600;
}

.section-count {
  font-size: 0.75rem;
  color: var(--text-subtle);
  font-variant-numeric: tabular-nums;
}

.section-copy {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.file-section .file-list {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
}

.password-section .btn-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ---------- Replies ---------- */
.reply-box-container {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  margin-top: 8px;
}

/* reply-feature.js toggles display between "block" and "none" inline */
.reply-box-container[style*="block"] {
  display: grid !important;
}

.reply-box-container > h3 {
  font-size: 0.9375rem;
}

.reply-search-container {
  position: relative;
}

.reply-search-container::before {
  content: "\f002";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.75rem;
  color: var(--text-subtle);
  pointer-events: none;
}

.reply-search-container input {
  width: 100%;
  max-width: 340px;
  height: 36px;
  padding: 0 12px 0 32px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 0.8125rem;
}

.reply-search-container input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

.reply-box-list {
  display: grid;
  gap: 10px;
}

/* Reply modal (built in reply-feature.js) */
.reply-modal-panel {
  max-width: 820px !important;
  display: grid;
  gap: 16px;
}

.reply-modal-panel #fileDropZone {
  padding: 16px;
}

.reply-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 4px;
}

#recipientContainer {
  gap: 6px;
}

#recipientContainer[style*="block"] {
  display: grid !important;
}

#recipientContainer label {
  font-size: 0.8125rem;
  font-weight: 500;
}

/* ---------- Compose (new message / request documents) ---------- */
.create-message-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex-shrink: 0; /* natural height (scrolls) unless the fit-to-window layout below applies */
}

/* Parts that belong to some modes only (data-for-mode lists them, e.g. "request sign") */
.create-message-form[data-mode="message"] [data-for-mode]:not([data-for-mode~="message"]),
.create-message-form[data-mode="request"] [data-for-mode]:not([data-for-mode~="request"]),
.create-message-form[data-mode="sign"] [data-for-mode]:not([data-for-mode~="sign"]) {
  display: none !important;
}

.compose-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 16px;
}

.compose-head h1 {
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

/* Mode switch: a compact two-way toggle */
.compose-mode {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border-radius: var(--radius-md);
  background: var(--surface-sunken);
  border: 1px solid var(--border);
}

.compose-mode__btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.84375rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
}

.compose-mode__btn:hover {
  color: var(--text);
}

.compose-mode__btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.compose-mode__btn[aria-checked="true"] {
  background: var(--surface);
  color: var(--accent-ink);
  font-weight: 600;
  box-shadow: var(--shadow-xs);
}

.compose-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 16px;
  align-items: stretch;
}

/* One card: slim rows, then the message fills what's left */
.compose-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}

/* The card is also the drop target (id fileDropZone); undo the generic drop-zone look */
.compose-main#fileDropZone {
  align-items: stretch;
  justify-content: flex-start;
  gap: 0;
  padding: 0;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  text-align: left;
  font-size: inherit;
  cursor: default;
}

.compose-main#fileDropZone:hover {
  border-color: var(--border);
  background: var(--surface);
}

.compose-main#fileDropZone.drag-over {
  border-color: var(--accent);
}

.compose-line {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 5px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.compose-line:focus-within {
  background: color-mix(in srgb, var(--accent-soft) 35%, transparent);
}

.compose-line__label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
}

.compose-line > .input-field {
  height: 36px;
  padding: 0 4px;
  border: 0;
  background: transparent;
  box-shadow: none;
  font-size: 0.90625rem;
}

.compose-line > .input-field:focus {
  box-shadow: none;
}

/* Recipients */
.receiver-block {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  min-width: 0;
  max-height: 74px;
  overflow-y: auto;
}

.receiver-block .input-field {
  flex: 1;
  min-width: 200px;
  width: auto;
  height: 34px;
  padding: 0 4px;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.receiver-block .input-field:focus {
  box-shadow: none;
}

.chips-container {
  display: contents;
}

.email-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  height: 28px;
  padding: 0 3px 0 3px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 0.8125rem;
  font-weight: 500;
}

.email-chip__avatar {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 0.6875rem;
  font-weight: 700;
}

.email-chip__text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.email-chip .remove-chip {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  font-size: 0.6875rem;
  cursor: pointer;
}

.email-chip .remove-chip:hover {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
}

.suggestions {
  display: none;
  position: absolute;
  left: 96px;
  right: 16px;
  top: calc(100% - 2px);
  z-index: 60;
  max-height: 240px;
  overflow-y: auto;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  box-shadow: var(--shadow-md);
}

.suggestion-item {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  cursor: pointer;
  overflow-wrap: anywhere;
}

.suggestion-item:hover {
  background: var(--surface-hover);
}

/* Message: grows to fill the card */
.compose-editor {
  flex: 1 1 auto;
  display: flex;
  min-height: 150px;
  padding: 10px 12px;
}

.compose-editor .sun-editor {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  width: 100% !important;
  height: auto !important;
  border: 0 !important;
}

.compose-editor .se-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.compose-editor .se-toolbar {
  border-radius: var(--radius-sm);
  outline: 0 !important;
}

.compose-editor .se-wrapper {
  flex: 1;
  min-height: 0;
}

.compose-editor .se-wrapper-inner {
  height: 100% !important;
  min-height: 100px !important;
}

.compose-editor .se-resizing-bar {
  display: none !important;
}

/* Attachments: a lively drop strip and colourful file cards */
.compose-attachments {
  display: grid;
  gap: 8px;
  padding: 10px 14px 12px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* Get it signed: supporting documents are folded behind a link until wanted */
.support-toggle {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 2px;
  border: 0;
  background: none;
  color: var(--accent-ink);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
}

.support-toggle span {
  color: var(--text-muted);
  font-weight: 500;
}

.support-toggle:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: 4px;
}

.compose-attachments:not(.is-folded) .support-toggle,
.create-message-form[data-mode="sign"] .compose-attachments.is-folded .attach-zone,
.create-message-form[data-mode="sign"] .compose-attachments.is-folded .compose-files {
  display: none !important;
}

.attach-zone {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  border: 1.5px dashed color-mix(in srgb, var(--accent) 45%, var(--border));
  background: linear-gradient(120deg, color-mix(in srgb, var(--accent-soft) 85%, var(--surface)), var(--surface) 70%);
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}

.attach-zone:hover {
  border-color: var(--accent);
}

.attach-zone__icon {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 0.9375rem;
  box-shadow: 0 4px 12px -4px color-mix(in srgb, var(--accent) 70%, transparent);
  transition: transform var(--dur-fast) var(--ease);
}

.attach-zone:hover .attach-zone__icon {
  transform: translateY(-2px);
}

.attach-zone__text {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.attach-zone__line {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.84375rem;
  font-weight: 500;
  color: var(--text);
}

.attach-zone__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  background: var(--surface);
  color: var(--accent-ink);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}

.attach-zone__btn:hover {
  background: var(--accent);
  color: var(--accent-text);
}

.attach-zone__btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.attach-zone__hint {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.attach-zone__hint i {
  font-size: 0.625rem;
  color: var(--accent-ink);
}

.attach-zone__count {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.attach-zone__count[hidden] {
  display: none;
}

#additionalFileAction:empty {
  display: none;
}

.compose-files {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
  max-height: 92px; /* two rows of cards, then it scrolls */
  overflow-y: auto;
  padding: 1px 2px 2px 1px;
}

.compose-files:empty {
  display: none;
}

.compose-files .file-item {
  --file-colour: #94a3b8;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 280px;
  height: 36px;
  padding: 0 4px 0 4px;
  border-radius: 10px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--file-colour);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  font-size: 0.78125rem;
  animation: file-card-in 0.22s var(--ease);
  transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}

.compose-files .file-item:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

@keyframes file-card-in {
  from {
    opacity: 0;
    transform: translateY(4px) scale(0.96);
  }
}

.compose-files .file-icon {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: color-mix(in srgb, var(--file-colour) 16%, transparent);
  font-size: 0.8125rem;
}

.compose-files .file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.compose-files .file-size {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.compose-files .remove-file {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-subtle);
  font-size: 0.6875rem;
  cursor: pointer;
}

.compose-files .remove-file:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

/* Dragging files over the composer */
.compose-main {
  position: relative;
}

.compose-drop-overlay {
  position: absolute;
  inset: 8px;
  z-index: 20;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: var(--radius-md);
  border: 2px dashed var(--accent);
  background: color-mix(in srgb, var(--accent-soft) 88%, transparent);
  backdrop-filter: blur(2px);
  color: var(--accent-ink);
  text-align: center;
  pointer-events: none;
}

.compose-main.drag-over .compose-drop-overlay {
  display: flex;
  animation: file-card-in 0.15s var(--ease);
}

.compose-drop-overlay__icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 1.5rem;
  box-shadow: 0 8px 24px -8px color-mix(in srgb, var(--accent) 80%, transparent);
}

.compose-drop-overlay strong {
  font-size: 1.0625rem;
}

.compose-drop-overlay span:last-child {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* Shorter screens (most laptops): keep everything in view */
@media (min-width: 900px) and (max-height: 820px) {
  .attach-zone {
    padding: 6px 10px;
  }

  .attach-zone__icon {
    width: 30px;
    height: 30px;
    font-size: 0.8125rem;
  }

  .attach-zone__hint {
    display: none;
  }

  /* …except the one saying supporting documents aren't signed */
  .create-message-form[data-mode="sign"] .attach-zone__hint[data-for-mode="sign"] {
    display: inline-flex;
  }

  /* One row of file cards that scrolls sideways */
  .compose-files {
    flex-wrap: nowrap;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 4px;
  }

  .compose-files .file-item {
    flex: 0 0 auto;
  }

  .compose-editor {
    min-height: 110px;
  }

  .compose-request {
    padding-top: 8px;
    padding-bottom: 10px;
  }
}

@media (min-width: 1101px) and (max-width: 1366px) {
  .compose-layout {
    grid-template-columns: minmax(0, 1fr) 250px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .compose-files .file-item,
  .compose-main.drag-over .compose-drop-overlay {
    animation: none;
  }
}

/* Summary */
.compose-summary {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.compose-summary h2 {
  font-size: 0.875rem;
  font-weight: 600;
}

.compose-checklist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.compose-checklist li {
  display: grid;
  grid-template-columns: 16px auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  font-size: 0.8125rem;
}

.compose-checklist li i {
  font-size: 0.8125rem;
}

.compose-checklist .is-done i {
  color: var(--success);
}

.compose-checklist .is-todo i {
  color: var(--warning);
}

.compose-checklist .is-optional i {
  color: var(--border-strong);
}

.compose-checklist__value {
  justify-self: end;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-muted);
  font-size: 0.78125rem;
}

.compose-expiry {
  display: grid;
  gap: 7px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.compose-expiry__label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  font-weight: 600;
}

.compose-expiry__options {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.compose-expiry__options button {
  height: 28px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font: inherit;
  font-size: 0.78125rem;
  font-weight: 500;
  cursor: pointer;
}

.compose-expiry__options button:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.compose-expiry__options button[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  color: var(--accent-ink);
  font-weight: 600;
}

.compose-expiry__options button:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.slider-container {
  display: flex;
  align-items: center;
  gap: 10px;
}

.slider-container[hidden] {
  display: none;
}

.slider-container input[type="range"] {
  flex: 1;
  min-width: 0;
}

#sliderValue {
  min-width: 60px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  border-radius: var(--radius-pill);
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  font-size: 0.75rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.compose-expiry__until {
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.compose-secure {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  padding: 9px 11px;
  border-radius: var(--radius-md);
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 0.75rem;
  line-height: 1.45;
}

.compose-secure i {
  margin-top: 2px;
}

.create-message-button {
  width: 100%;
  height: 42px;
  margin-top: auto;
  padding: 0 18px;
  font-size: 0.90625rem;
  flex-shrink: 0;
}

/* Fit the whole composer in the window: no page scrolling, the message box takes the spare height */
@media (min-width: 900px) and (min-height: 600px) {
  .chat-window:has(> .create-message-form) {
    overflow: hidden;
    padding: 18px 24px;
  }

  .chat-window > .create-message-form {
    flex: 1 1 auto;
    min-height: 0;
    max-width: 1240px;
  }

  .compose-layout {
    flex: 1 1 auto;
    min-height: 0;
  }
}

@media (max-width: 1100px) {
  .compose-layout {
    grid-template-columns: minmax(0, 1fr) 240px;
  }
}

@media (max-width: 899px), (max-height: 599px) {
  .compose-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .compose-editor {
    min-height: 260px;
  }
}

@media (max-width: 560px) {
  .compose-head h1 {
    width: 100%;
  }

  .compose-mode {
    width: 100%;
  }

  .compose-mode__btn {
    flex: 1;
    justify-content: center;
    padding: 0 8px;
  }

  .compose-line {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    padding: 8px 14px;
  }

  .suggestions {
    left: 14px;
  }

  .receiver-block .input-field {
    min-width: 140px;
  }


  .compose-files {
    max-height: none;
  }

  .receiver-block {
    max-height: none;
  }
}

/* ---------- History ---------- */
.history-view {
  display: grid;
  gap: 16px;
  align-content: start;
}

.history-view .page-head {
  margin-bottom: 0;
}

/* Tips (dismissible) */
.hist-guide {
  position: relative;
  padding: 16px 48px 16px 18px;
  border-radius: var(--radius-lg);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
}

.hist-guide[hidden] {
  display: none;
}

.hist-guide ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.hist-guide li {
  display: flex;
  gap: 10px;
  font-size: 0.84375rem;
  line-height: 1.45;
  color: var(--text-muted);
}

.hist-guide li strong {
  display: block;
  color: var(--text);
  font-weight: 600;
}

.hist-guide__num {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 0.75rem;
  font-weight: 700;
}

.hist-guide__close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.hist-guide__close:hover {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--text);
}

/* Summary numbers (each one filters the list) */
.hist-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.hist-stats:empty {
  display: none;
}

.hist-stat {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 10px;
  align-items: center;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease);
}

.hist-stat:hover {
  border-color: var(--border-strong);
}

.hist-stat:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.hist-stat i {
  grid-row: 1 / 3;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 0.875rem;
}

.hist-stat strong {
  font-size: 1.25rem;
  font-weight: 650;
  line-height: 1.1;
}

.hist-stat span {
  font-size: 0.78125rem;
  color: var(--text-muted);
}

/* Search and filters */
.hist-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hist-toolbar .search-field {
  position: relative;
  flex: 1 1 260px;
  min-width: 0;
}

.hist-toolbar .search-field i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.75rem;
  color: var(--text-subtle);
  pointer-events: none;
}

.hist-toolbar #historySearch {
  padding-left: 32px;
}

.hist-period {
  flex: 0 0 auto;
  width: 170px;
}

.hist-toolbar #historyDate {
  flex: 0 0 auto;
  width: 170px;
  font-variant-numeric: tabular-nums;
}

.hist-toolbar #historyDate[hidden] {
  display: none;
}

.hist-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

.hist-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.hist-chips button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}

.hist-chips button i {
  font-size: 0.71875rem;
}

.hist-chips button:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.hist-chips button[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
  color: var(--accent-ink);
  font-weight: 600;
}

.hist-chips button:focus-visible,
.hist-item__head:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.hist-count {
  margin: 0 0 0 auto;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.clear-date-btn[hidden] {
  display: none;
}

/* The list */
.hist-list {
  display: grid;
  gap: 8px;
}

.hist-group {
  margin: 12px 0 2px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-subtle);
}

.hist-group:first-child {
  margin-top: 0;
}

.hist-item {
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}

.hist-item:hover {
  border-color: var(--border-strong);
}

.hist-item.is-open {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  box-shadow: var(--shadow-sm);
}

.hist-item__head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px 16px;
  border: 0;
  border-radius: inherit;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.hist-item__icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 0.9375rem;
}

.hist-item--expired .hist-item__icon,
.hist-item--deleted .hist-item__icon {
  background: var(--surface-sunken);
  color: var(--text-subtle);
}

.hist-item__main {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.hist-item__subject {
  font-size: 0.9375rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hist-item__to {
  font-size: 0.8125rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hist-item__pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.hist-item__pills:empty {
  display: none;
}

.hist-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
}

.hist-pill i {
  font-size: 0.65625rem;
}

.hist-pill--success {
  background: var(--success-soft);
  border-color: transparent;
  color: var(--success);
}

.hist-pill--partial {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent-ink);
}

.hist-pill--waiting {
  background: var(--warning-soft);
  border-color: transparent;
  color: var(--warning);
}

.hist-item__date {
  font-size: 0.78125rem;
  color: var(--text-muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.hist-item__chevron {
  color: var(--text-subtle);
  font-size: 0.75rem;
  transition: transform var(--dur-fast) var(--ease);
}

.hist-item.is-open .hist-item__chevron {
  transform: rotate(180deg);
}

/* Opened row */
.hist-item__body {
  display: grid;
  gap: 18px;
  padding: 4px 16px 16px 68px;
}

.hist-item__body[hidden] {
  display: none;
}

.hist-detail h3 {
  margin-bottom: 10px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-subtle);
}

.hist-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: 24px;
}

.hist-timeline ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
}

.hist-event {
  position: relative;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 12px;
  padding-bottom: 14px;
}

/* The line joining the steps */
.hist-event:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 13.5px;
  top: 30px;
  bottom: 2px;
  width: 1px;
  background: var(--border-strong);
}

.hist-event__icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.71875rem;
}

.hist-event--message_created .hist-event__icon {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}

.hist-event--message_accessed .hist-event__icon,
.hist-event--reply_accessed .hist-event__icon {
  background: var(--success-soft);
  border-color: transparent;
  color: var(--success);
}

.hist-event--message_deleted .hist-event__icon {
  background: var(--danger-soft);
  border-color: transparent;
  color: var(--danger);
}

.hist-event__text {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding-top: 4px;
  font-size: 0.84375rem;
}

.hist-event__text strong {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.hist-event__text span,
.hist-event__text time {
  font-size: 0.78125rem;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

.hist-event__text time {
  color: var(--text-subtle);
  font-variant-numeric: tabular-nums;
}

.hist-event__files {
  margin-top: 2px;
}

.hist-reader {
  margin-top: 8px;
  min-width: 0;
}

.hist-people ul {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  display: grid;
  gap: 8px;
}

.hist-people li {
  display: grid;
  gap: 1px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
  font-size: 0.84375rem;
}

.hist-person__mail {
  font-weight: 500;
  overflow-wrap: anywhere;
}

.hist-person__state {
  font-size: 0.78125rem;
  color: var(--text-muted);
}

.hist-person__state--opened {
  color: var(--success);
}

.hist-facts {
  display: grid;
  gap: 8px;
  margin: 0;
}

.hist-facts div {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  gap: 8px;
  font-size: 0.8125rem;
}

.hist-facts dt {
  color: var(--text-muted);
}

.hist-facts dd {
  margin: 0;
  display: grid;
  gap: 2px;
  overflow-wrap: anywhere;
}

.hist-file i {
  font-size: 0.6875rem;
  color: var(--text-subtle);
}

.hist-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.hist-muted {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.hist-empty {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 48px 16px;
  text-align: center;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  color: var(--text-muted);
  font-size: 0.84375rem;
}

.hist-empty i {
  font-size: 1.375rem;
  color: var(--text-subtle);
  margin-bottom: 4px;
}

.hist-empty strong {
  font-size: 0.9375rem;
  color: var(--text);
}

.hist-empty .btn {
  margin-top: 8px;
}

.hist-more {
  display: flex;
  justify-content: center;
}

.hist-more .btn[hidden] {
  display: none;
}

@media (max-width: 900px) {
  .hist-guide ol {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

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

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

  .hist-item__body {
    padding-left: 16px;
  }
}

@media (max-width: 560px) {
  .hist-item__head {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 10px;
    padding: 12px;
  }

  .hist-item__icon {
    width: 32px;
    height: 32px;
    font-size: 0.8125rem;
  }

  .hist-item__date {
    grid-column: 2;
    grid-row: 2;
  }

  .hist-item__chevron {
    grid-column: 3;
    grid-row: 1;
  }

  .hist-item__body {
    padding: 4px 12px 12px;
  }

  .hist-period,
  .hist-toolbar #historyDate {
    flex: 1 1 140px;
    width: auto;
  }

  .hist-count {
    margin-left: 0;
    width: 100%;
  }
}

/* ---------- Secret key modals ---------- */
.secret-modal {
  max-width: 480px;
}

.secret-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 0.71875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-ink);
}

.secret-kicker::before {
  content: "\f084";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  font-size: 0.75rem;
  letter-spacing: 0;
}

.secret-copy {
  color: var(--text-muted);
  font-size: 0.875rem;
  line-height: 1.6;
}

.secret-copy strong {
  color: var(--text);
}

.secret-warning {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  line-height: 1.5;
}

.secret-warning--info {
  background: var(--warning-soft);
  color: var(--text);
}

.secret-warning--alert {
  background: var(--danger-soft);
  color: var(--text);
}

.secret-warning__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  border-radius: 50%;
  flex-shrink: 0;
  font-size: 0.6875rem;
  font-weight: 700;
  color: #fff;
  background: var(--warning);
}

.secret-warning--alert .secret-warning__icon {
  background: var(--danger);
}

#secretKeyValue {
  margin-top: 16px;
  padding: 18px 16px;
  border-radius: var(--radius-md);
  border: 1px dashed var(--border-strong);
  background: var(--surface-sunken);
  font-family: var(--font-mono);
  font-size: 1.375rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-align: center;
  color: var(--text);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  user-select: all;
}

.secret-helper {
  margin-top: 6px;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.secret-helper--compact {
  font-size: 0.78125rem;
  color: var(--text-subtle);
}

#inputSecretKeyField {
  margin-top: 16px;
  font-family: var(--font-mono);
  font-size: 1rem;
  letter-spacing: 0.12em;
}

.secret-error {
  display: none;
  margin-top: 8px;
  font-size: 0.8125rem;
  color: var(--danger);
}

.secret-link-card {
  display: grid;
  gap: 2px;
  width: 100%;
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  text-align: left;
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}

.secret-link-card:hover {
  border-color: var(--border-strong);
  background: var(--surface-hover);
}

.secret-link-card__eyebrow {
  font-size: 0.75rem;
  color: var(--text-subtle);
}

.secret-link-card strong {
  font-size: 0.84375rem;
}

.secret-link-card__description {
  font-size: 0.78125rem;
  color: var(--text-muted);
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .feature-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .feature-item:nth-child(n) {
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
  }

  .feature-item:nth-child(2n) {
    border-right: 0;
  }

  .feature-item:nth-last-child(-n + 2) {
    border-bottom: 0;
  }

  .user-email {
    max-width: 160px;
  }
}

@media (max-width: 900px) {
  .container {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 2000;
    width: min(86vw, 320px);
    box-shadow: var(--shadow-lg);
    transform: translateX(-102%);
    transition: transform var(--dur-slow) var(--ease);
    visibility: hidden;
  }

  .sidebar.open {
    transform: translateX(0);
    visibility: visible;
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1999;
    display: block;
    background: var(--overlay);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--dur-slow) var(--ease);
  }

  .sidebar.open ~ .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .sidebar-toggle,
  .sidebar-close-btn {
    display: inline-flex;
  }

  .chat-header {
    padding: 0 12px;
  }

  .chat-window,
  #historyContainer {
    padding: 24px 20px 48px;
  }
}

@media (max-width: 720px) {
  .chat-header .shield-icon,
  .topbar-title span,
  .user-email,
  .home-link .label,
  .logout-button .label,
  .topbar-divider {
    display: none;
  }

  .home-link {
    width: var(--control-h);
    padding: 0;
    justify-content: center;
  }

  .logout-button {
    width: var(--control-h);
    padding: 0;
  }

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

  .feature-item:nth-child(n) {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .feature-item:last-child {
    border-bottom: 0;
  }

  .welcome-hero h1 {
    font-size: 1.5rem;
  }

  .detail-header {
    flex-direction: column;
  }

  .reply-button-container {
    border-right: 0;
    padding-right: 0;
    width: 100%;
  }

  .action-buttons > *,
  .reply-button-container > * {
    flex: 1 1 auto;
  }


  .detail-block {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
  }

  #confirm-and-cancel-div,
  .secret-modal-buttons,
  .ui-dialog__footer {
    flex-direction: column-reverse;
  }

  #confirm-and-cancel-div > *,
  .secret-modal-buttons > *,
  .ui-dialog__footer > * {
    width: 100%;
  }

}

@media (max-width: 480px) {
  .chat-window,
  #historyContainer {
    padding: 20px 16px 40px;
  }

  .conversation-detail-card {
    padding: 16px;
  }

  .modal-content {
    padding: 20px;
  }
}

/* ---------- Secure requests ---------- */
/* Request files / Get signed, side by side under New message */
.new-message-extra {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-top: 8px;
}

.new-message-extra .request-files-button {
  margin-top: 0;
  padding: 0 8px;
  white-space: nowrap;
}

.request-files-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 36px;
  margin-top: 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.84375rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}

.request-files-button:hover {
  background: var(--surface-hover);
}

.request-files-button:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.request-files-button i {
  color: var(--accent-ink);
}

.compose-request {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  align-items: start;
  column-gap: 10px;
  row-gap: 8px;
  padding: 10px 16px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.compose-request > .compose-line__label {
  padding-top: 9px;
  line-height: 1.25;
}

/* One field: numbered chips followed by the text box */
.request-picker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-height: 42px;
  max-height: 112px;
  overflow-y: auto;
  padding: 5px 8px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  cursor: text;
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}

.request-picker:focus-within {
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

.request-tags {
  display: contents;
  list-style: none;
  counter-reset: request-tag;
}

.request-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  height: 28px;
  padding: 0 3px 0 3px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 0.8125rem;
  font-weight: 500;
  counter-increment: request-tag;
  animation: request-tag-in var(--dur-fast) var(--ease);
}

@keyframes request-tag-in {
  from {
    transform: scale(0.92);
    opacity: 0;
  }
}

.request-tag__num {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 0.6875rem;
  font-weight: 700;
}

.request-tag__num::before {
  content: counter(request-tag);
}

.request-tag__text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.request-tag__remove {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  font-size: 0.6875rem;
  cursor: pointer;
}

.request-tag__remove:hover {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
}

.request-tag__remove:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.request-picker__input {
  flex: 1;
  min-width: 200px;
  height: 30px;
  padding: 0 4px;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
}

.request-picker__input:focus {
  outline: none;
}

.request-picker__input::placeholder {
  color: var(--text-subtle);
}

/* Suggestions: all visible, one click adds */
.request-suggest {
  grid-column: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-height: 0;
}

.request-suggest__label {
  margin-right: 2px;
  font-size: 0.75rem;
  color: var(--text-subtle);
}

.request-suggest__label:empty {
  display: none;
}

.request-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px dashed var(--border-strong);
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.78125rem;
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}

.request-chip i {
  font-size: 0.625rem;
}

.request-chip:hover,
.request-chip:focus-visible {
  outline: none;
  border-style: solid;
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-ink);
}

/* Phones: the label sits above the field (kept after the rules above so it wins) */
@media (max-width: 560px) {
  .compose-request {
    grid-template-columns: minmax(0, 1fr);
    padding: 10px 14px 12px;
  }

  .compose-request > .compose-line__label {
    padding-top: 0;
  }

  .request-suggest {
    grid-column: 1;
  }

  .request-picker {
    max-height: none;
  }

  .request-picker__input {
    min-width: 140px;
  }
}

.conversation-kind {
  font-size: 0.6875rem;
  color: var(--accent-ink);
}

/* Progress of a request (conversation view) */
.request-status {
  display: grid;
  gap: 12px;
}

.request-status .section-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.request-status__loading,
.request-status__note {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.request-status__note i {
  color: var(--accent-ink);
  margin-right: 4px;
}

.request-people {
  display: grid;
  gap: 10px;
}

.request-person {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface-sunken);
}

.request-person__head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 12px;
  margin-bottom: 8px;
  font-size: 0.84375rem;
}

.request-person__mail {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.request-person__state {
  font-size: 0.78125rem;
  color: var(--warning);
}

.request-person__state.is-done {
  color: var(--success);
}

.request-check {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.request-check li {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  column-gap: 8px;
  font-size: 0.84375rem;
}

.request-check li > i {
  grid-row: 1 / 3;
  margin-top: 3px;
  font-size: 0.75rem;
  color: var(--border-strong);
}

.request-check li.is-done > i {
  color: var(--success);
}

.request-check__files {
  font-size: 0.78125rem;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

@media (max-width: 560px) {

}

.conversation-editor-wrapper[hidden] {
  display: none;
}

/* ---------- Views and folders (sidebar) ---------- */
.mail-nav {
  flex-shrink: 0;
  max-height: 42vh;
  overflow-y: auto;
  padding: 2px 8px 6px;
  border-bottom: 1px solid var(--border);
  scrollbar-width: thin;
}

.mail-nav:empty {
  display: none;
}

.mail-nav__list {
  display: grid;
  gap: 1px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.mail-nav__list[hidden] {
  display: none;
}

.mail-nav__item {
  position: relative;
  display: flex;
  align-items: center;
  border-radius: var(--radius-sm);
  transition: background var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}

.mail-nav__item:hover {
  background: var(--surface-hover);
}

.mail-nav__item.is-active {
  background: var(--accent-soft);
}

.mail-nav__item.is-drop {
  background: var(--accent-soft);
  box-shadow: 0 0 0 2px var(--accent) inset;
}

body.is-dragging-message .mail-nav__item.is-folder,
body.is-dragging-message .mail-nav__item:has([data-view="all"]) {
  outline: 1px dashed color-mix(in srgb, var(--accent) 45%, transparent);
  outline-offset: -1px;
}

.mail-nav__btn {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 0.84375rem;
  text-align: left;
  cursor: pointer;
}

.mail-nav__btn:focus-visible,
.mail-nav__more:focus-visible,
.mail-nav__toggle:focus-visible,
.mail-nav__new:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.mail-nav__btn > i {
  width: 16px;
  text-align: center;
  color: var(--text-subtle);
  font-size: 0.8125rem;
}

.mail-nav__item.is-active .mail-nav__btn {
  font-weight: 600;
  color: var(--accent-ink);
}

.mail-nav__item.is-active .mail-nav__btn > i,
.mail-nav__item.is-folder .mail-nav__btn > i {
  color: var(--accent-ink);
}

.mail-nav__label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mail-nav__count {
  min-width: 20px;
  padding: 0 6px;
  border-radius: var(--radius-pill);
  background: var(--surface-sunken);
  color: var(--text-muted);
  font-size: 0.71875rem;
  font-weight: 600;
  line-height: 18px;
  text-align: center;
}

.mail-nav__count.is-alert {
  background: var(--warning-soft);
  color: var(--warning);
}

.mail-nav__more {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  margin-right: 3px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  opacity: 0;
}

.mail-nav__item:hover .mail-nav__more,
.mail-nav__item:focus-within .mail-nav__more,
.mail-nav__item.is-active .mail-nav__more {
  opacity: 1;
}

.mail-nav__more:hover {
  background: var(--surface);
}

.mail-nav__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 8px 0 2px;
  padding: 0 2px 0 4px;
}

.mail-nav__toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 4px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
}

.mail-nav__toggle i {
  font-size: 0.5625rem;
}

.mail-nav__new {
  display: grid;
  place-items: center;
  width: 28px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--accent-ink);
  font-size: 0.8125rem;
  cursor: pointer;
}

.mail-nav__new:hover {
  background: var(--accent-soft);
}

.mail-nav__empty {
  padding: 4px 10px 6px;
  font-size: 0.78125rem;
  line-height: 1.45;
  color: var(--text-muted);
}

/* List heading: the view's name, how many, and Select */
#listLabel {
  align-items: center;
}

.list-label__count {
  margin-left: 4px;
  color: var(--text-subtle);
  font-weight: 600;
}

.list-label__select {
  padding: 2px 6px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--accent-ink);
  font: inherit;
  font-size: 0.78125rem;
  font-weight: 600;
  cursor: pointer;
}

.list-label__select[aria-pressed="true"] {
  background: var(--accent-soft);
}

.list-label__select:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* Selecting several */
.conversations.is-selecting .conversation {
  padding-left: 40px;
  position: relative;
}

.conversation-check {
  position: absolute;
  left: 12px;
  top: 14px;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 5px;
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  color: transparent;
  font-size: 0.625rem;
}

.conversation.is-selected .conversation-check {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-text);
}

.conversations.is-selecting .conversation.is-selected {
  background: var(--accent-soft);
}

.selection-bar {
  flex-shrink: 0;
  display: grid;
  gap: 8px;
  margin: 0 8px 8px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 -6px 18px -12px rgba(0, 0, 0, 0.25);
}

.selection-bar__count {
  font-size: 0.8125rem;
  font-weight: 600;
}

.selection-bar__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* Which folder an item is in (shown outside folder views) */
.folder-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 140px;
  padding: 1px 7px;
  border-radius: var(--radius-pill);
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.6875rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.folder-chip i {
  color: var(--accent-ink);
  font-size: 0.625rem;
}

/* Menus: move to folder, folder options */
.folder-menu {
  position: fixed;
  z-index: 4000;
  display: grid;
  min-width: 200px;
  max-width: 280px;
  max-height: 50vh;
  overflow-y: auto;
  padding: 4px;
  border-radius: var(--radius-md);
  background: var(--surface-raised, var(--surface));
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}

.folder-menu button {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 0.84375rem;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folder-menu button i {
  width: 16px;
  color: var(--accent-ink);
}

.folder-menu button:hover,
.folder-menu button:focus-visible {
  background: var(--surface-hover);
  outline: none;
}

.folder-menu button.is-danger,
.folder-menu button.is-danger i {
  color: var(--danger);
}

/* Conversation header: folder picker */
.folder-pick {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 4px 2px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.78125rem;
}

.folder-pick i {
  color: var(--accent-ink);
  font-size: 0.6875rem;
}

.folder-pick select {
  max-width: 200px;
  padding: 3px 4px;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.folder-pick:focus-within {
  box-shadow: var(--focus-ring);
}

.folder-pick select:focus {
  outline: none;
}

/* Your own attachments: download */
.file-section .file-item {
  position: relative;
}

.file-section .file-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.file-section .file-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-download {
  margin-left: auto;
  flex-shrink: 0;
}

.file-download__progress {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 3px;
  height: 3px;
  border-radius: 2px;
  background: var(--surface-sunken);
  overflow: hidden;
}

.file-download__progress[hidden] {
  display: none;
}

.file-download__progress span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width var(--dur-fast) var(--ease);
}

/* ---------- Team inboxes ---------- */
.mail-nav__toggle--static {
  cursor: default;
}

.team-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 180px;
  padding: 1px 7px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 0.6875rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.team-chip i {
  font-size: 0.625rem;
}

.detail-meta .team-chip {
  max-width: none;
  font-size: 0.78125rem;
  font-weight: 500;
  padding: 2px 10px;
}

.compose-from select {
  max-width: 420px;
}

/* ---------- Sensitive information check (composer) ---------- */
.sens-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  font-size: 0.8125rem;
  line-height: 1.45;
}

.sens-card[hidden] {
  display: none;
}

.sens-card > div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.sens-card span {
  color: var(--text-muted);
  font-size: 0.78125rem;
  overflow-wrap: anywhere;
}

.sens-card.is-checking {
  align-items: center;
  color: var(--text-muted);
}

.sens-card.is-clear > i {
  margin-top: 2px;
  color: var(--success);
}

.sens-card.is-found {
  display: grid;
  gap: 8px;
  border-color: color-mix(in srgb, var(--warning) 45%, var(--border));
  background: var(--warning-soft);
}

.sens-card > .sens-card__head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sens-card__head i {
  color: var(--warning);
}

.sens-card__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.sens-card__chips li {
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.75rem;
  font-weight: 600;
}

.sens-card__chips li.is-likely {
  font-weight: 500;
  border-style: dashed;
}

.sens-card__chips em {
  color: var(--text-muted);
  font-style: normal;
  font-weight: 500;
}

.sens-card__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 6px;
  margin: 0;
}

.sens-card__skipped {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.75rem;
  overflow-wrap: anywhere;
}

.sens-card__review {
  justify-self: start;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent-ink);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

/* Review dialog */
.sens-review__file {
  display: grid;
  gap: 8px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.sens-review__file:first-child {
  padding-top: 0;
}

.sens-review__file h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 0.875rem;
  overflow-wrap: anywhere;
}

.sens-review__file h3 i {
  color: var(--accent-ink);
}

.sens-review__partial,
.sens-review__none {
  color: var(--text-muted);
  font-size: 0.78125rem;
  font-weight: 500;
  margin: 0;
}

.sens-review__item {
  display: grid;
  gap: 4px;
}

.sens-review__label {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.8125rem;
}

.sens-tag {
  padding: 1px 7px;
  border-radius: var(--radius-pill);
  font-size: 0.6875rem;
  font-weight: 700;
}

.sens-tag.is-sure {
  background: var(--warning-soft);
  color: var(--warning);
}

.sens-tag.is-likely {
  background: var(--surface-sunken);
  color: var(--text-muted);
}

.sens-review__count {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.sens-review__examples {
  display: grid;
  gap: 3px;
  margin: 0;
  padding: 0 0 0 14px;
  font-size: 0.78125rem;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

.sens-review__examples mark {
  padding: 0 2px;
  border-radius: 3px;
  background: color-mix(in srgb, var(--warning) 35%, transparent);
  color: var(--text);
  font-weight: 600;
}

.sens-review__note {
  display: flex;
  gap: 8px;
  margin: 12px 0 0;
  font-size: 0.78125rem;
  line-height: 1.45;
  color: var(--text-muted);
}

.sens-review__note i {
  margin-top: 2px;
}

/* ---------- Security labels and sensitive information ---------- */
.label-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: var(--radius-sm);
  border: 1px solid color-mix(in srgb, var(--warning) 55%, transparent);
  background: var(--warning-soft);
  color: var(--warning);
  font-size: 0.71875rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.label-badge i {
  font-size: 0.625rem;
}

.compose-label {
  display: grid;
  gap: 5px;
  font-size: 0.8125rem;
  font-weight: 600;
}

.compose-label i {
  color: var(--warning);
}

.compose-label__opt {
  color: var(--text-muted);
  font-weight: 500;
}

.sens-card__alert {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin: 0;
  font-size: 0.78125rem;
  font-weight: 600;
  color: var(--text);
}

.sens-card__alert i {
  margin-top: 2px;
  color: var(--warning);
}

.received-sens {
  margin: 4px 0;
}

.sens-review__redact {
  margin-left: auto;
}

/* ---------- New replies and why something needs attention ---------- */
.conversation.has-new .contact-name {
  font-weight: 700;
}

.conversation.has-new .contact-name::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: 1px;
}

.conversation-reasons {
  display: grid;
  gap: 3px;
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
}

.conversation-reason {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  line-height: 1.35;
  color: var(--text-muted);
  background: var(--surface-sunken);
}

.conversation-reason i {
  flex-shrink: 0;
  width: 13px;
  text-align: center;
}

.conversation-reason__text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-reason__when {
  flex-shrink: 0;
  margin-left: auto;
  color: var(--text-subtle);
  font-variant-numeric: tabular-nums;
}

.conversation-reason--new {
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-weight: 600;
}

.conversation-reason--warning i {
  color: var(--warning);
}

.conversation-reason--danger {
  color: var(--danger);
}

.new-replies-jump {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--accent-text);
  font: inherit;
  font-size: 0.78125rem;
  font-weight: 600;
  cursor: pointer;
}

.new-replies-jump:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.reply-meta-badges {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.reply-new-badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--accent-text);
  font-size: 0.75rem;
  font-weight: 600;
}

.reply-box--new {
  border-left-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-soft);
}

/* ---------- Redact files (top bar → Redact) ---------- */
.redact-page {
  display: grid;
  gap: 16px;
  align-content: start;
}

.redact-page .page-head {
  margin-bottom: 0;
}

.redact-drop {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 22px;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}

.redact-drop:hover,
.redact-drop.is-drag,
.redact-drop:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
  outline: none;
}

.redact-drop__icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: #1f2430;
  color: #fff;
  font-size: 1.125rem;
}

.redact-drop__text {
  display: grid;
  gap: 2px;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.redact-drop__text strong {
  font-size: 0.90625rem;
  color: var(--text);
}

.redact-files {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.redact-files:empty {
  display: none;
}

.redact-files__empty {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-subtle);
}

.redact-file {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.redact-file.is-done {
  border-color: color-mix(in srgb, var(--success, #16a34a) 45%, var(--border));
}

.redact-file__icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
  color: var(--text-muted);
}

.redact-file__text {
  display: grid;
  gap: 2px;
  flex: 1 1 220px;
  min-width: 0;
}

.redact-file__text strong {
  overflow: hidden;
  font-size: 0.875rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.redact-file__text span {
  font-size: 0.78125rem;
  color: var(--text-muted);
}

.redact-file.is-done .redact-file__text .fa-circle-check {
  color: var(--success, #16a34a);
}

.redact-file__actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.redact-file__remove {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-subtle);
  cursor: pointer;
}

.redact-file__remove:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.redact-page__how {
  display: grid;
  gap: 8px;
  margin: 4px 0 0;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--surface-sunken);
  list-style: none;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.redact-page__how li {
  display: flex;
  gap: 10px;
}

.redact-page__how i {
  flex-shrink: 0;
  width: 16px;
  margin-top: 2px;
  color: var(--accent);
  text-align: center;
}

.redact-keep-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: var(--accent-soft);
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--text);
}

.redact-keep-note:empty {
  display: none;
}

.redact-keep-note i {
  margin-top: 2px;
  color: var(--accent-ink);
}

.redact-kept {
  display: grid;
  gap: 10px;
}

.redact-kept h2 {
  margin: 8px 0 0;
  font-size: 0.9375rem;
}

.redact-file__expiry {
  white-space: nowrap;
}

.redact-file__warn {
  color: var(--danger);
}

.redact-file__changes {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--text-subtle);
}

/* ---------- My files (top bar → Files) ---------- */
.files-page {
  display: grid;
  gap: 14px;
  align-content: start;
}

.files-page.is-dragging .files-main {
  outline: 2px dashed var(--accent);
  outline-offset: 4px;
  border-radius: var(--radius-lg);
  background: var(--accent-soft);
}

.files-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.files-head h1 {
  margin: 2px 0 0;
}

.files-head__actions {
  display: flex;
  gap: 8px;
}

.files-usage {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.files-usage__bar {
  flex: 0 0 180px;
  height: 6px;
  border-radius: 999px;
  background: var(--surface-sunken);
  overflow: hidden;
}

.files-usage__bar span {
  display: block;
  height: 100%;
  background: var(--accent);
}

.files-usage.is-high .files-usage__bar span {
  background: var(--warning);
}

.files-usage.is-full .files-usage__bar span {
  background: var(--danger);
}

.files-usage__text strong {
  color: var(--text);
}

.files-usage__text em {
  font-style: normal;
  color: var(--danger);
}

.files-usage__note {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--text-subtle);
}

.files-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  border-bottom: 1px solid var(--border);
}

.files-tabs {
  display: flex;
  gap: 4px;
}

.files-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 12px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.84375rem;
  cursor: pointer;
}

.files-tab[aria-selected="true"] {
  border-bottom-color: var(--accent);
  color: var(--text);
  font-weight: 600;
}

.files-tab__n:not(:empty) {
  padding: 0 6px;
  border-radius: 999px;
  background: var(--surface-sunken);
  font-size: 0.71875rem;
}

.files-search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  margin-bottom: 6px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-subtle);
}

.files-search:focus-within {
  border-color: var(--accent);
}

.files-search input {
  width: 200px;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.8125rem;
  outline: none;
}

.files-crumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 30px;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.files-crumbs > i {
  font-size: 0.625rem;
  color: var(--text-subtle);
}

.files-crumb {
  padding: 4px 8px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.files-crumb:hover,
.files-crumb.is-drop {
  background: var(--surface-hover);
}

.files-crumbs__note {
  font-size: 0.78125rem;
  color: var(--text-subtle);
}

.files-empty-bin {
  margin-left: auto;
}

.files-uploads {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.files-uploads:empty {
  display: none;
}

.files-upload {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  font-size: 0.8125rem;
}

.files-upload.is-error {
  border-color: color-mix(in srgb, var(--danger) 45%, var(--border));
}

.files-upload.is-error > i {
  color: var(--danger);
}

.files-upload__name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.files-upload__bar {
  flex: 0 0 140px;
  height: 5px;
  border-radius: 999px;
  background: var(--surface-sunken);
  overflow: hidden;
}

.files-upload__bar span {
  display: block;
  height: 100%;
  background: var(--accent);
  transition: width 0.2s;
}

.files-upload__pct {
  width: 38px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}

.files-upload__err {
  color: var(--danger);
  font-size: 0.78125rem;
}

.files-upload__x {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.125rem;
  cursor: pointer;
}

.files-main {
  min-height: 200px;
}

.files-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84375rem;
}

.files-table th {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 0.75rem;
  font-weight: 600;
  text-align: left;
  color: var(--text-subtle);
}

.files-table th.num,
.files-table td.num {
  text-align: right;
}

.files-row td {
  padding: 4px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.files-row:hover td,
.files-row.is-drop td {
  background: var(--surface-hover);
}

.files-row.is-drop td {
  box-shadow: inset 0 0 0 1px var(--accent);
}

.files-row__name {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-width: 0;
  padding: 6px 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.files-row__name:disabled {
  cursor: default;
}

.files-row__name > span {
  display: grid;
  min-width: 0;
}

.files-row__label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.files-row__name:not(:disabled):hover .files-row__label {
  text-decoration: underline;
}

.files-row__where {
  font-size: 0.75rem;
  color: var(--text-subtle);
}

.files-row__icon {
  flex-shrink: 0;
  width: 20px;
  font-size: 1.0625rem;
  text-align: center;
  color: var(--text-muted);
}

.files-row__icon--folder { color: #d4a72c; }
.files-row__icon--pdf { color: #e5484d; }
.files-row__icon--doc,
.files-row__icon--docx { color: #3e7bfa; }
.files-row__icon--xls,
.files-row__icon--xlsx,
.files-row__icon--csv { color: #30a46c; }
.files-row__icon--png,
.files-row__icon--jpg,
.files-row__icon--jpeg,
.files-row__icon--gif,
.files-row__icon--webp { color: #8e4ec6; }

.files-row__meta {
  white-space: nowrap;
  color: var(--text-muted);
  font-size: 0.78125rem;
  font-variant-numeric: tabular-nums;
}

.files-row__actions {
  width: 1%;
  white-space: nowrap;
  text-align: right;
}

.files-icon-btn {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.files-icon-btn:hover {
  background: var(--surface-sunken);
  color: var(--text);
}

.files-empty {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 56px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.84375rem;
}

.files-empty > i {
  font-size: 1.875rem;
  color: var(--text-subtle);
}

.files-empty strong {
  font-size: 0.9375rem;
  color: var(--text);
}

.files-menu {
  position: fixed;
  z-index: 4000;
  display: grid;
  min-width: 190px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-lg, 0 12px 32px rgba(0, 0, 0, 0.25));
}

.files-menu__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.8125rem;
  text-align: left;
  cursor: pointer;
}

.files-menu__item i {
  width: 16px;
  color: var(--text-muted);
  text-align: center;
}

.files-menu__item:hover,
.files-menu__item:focus-visible {
  background: var(--surface-hover);
  outline: none;
}

.files-menu__item.is-danger,
.files-menu__item.is-danger i {
  color: var(--danger);
}

.files-pick {
  display: grid;
  gap: 2px;
  max-height: 50vh;
  overflow-y: auto;
}

.files-pick__row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.84375rem;
  cursor: pointer;
}

.files-pick__row:hover {
  background: var(--surface-hover);
}

.files-pick__row i {
  color: #d4a72c;
}

.files-pick__row .fa-house {
  color: var(--text-muted);
}

/* Preview */
.file-viewer {
  position: fixed;
  inset: 0;
  z-index: 3500;
  display: flex;
  flex-direction: column;
  background: rgba(10, 12, 16, 0.92);
}

.file-viewer__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.file-viewer__name {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 0.875rem;
}

.file-viewer__name span {
  font-size: 0.78125rem;
  color: var(--text-muted);
}

.file-viewer__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.file-viewer__close {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font-size: 1.125rem;
  cursor: pointer;
}

.file-viewer__body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 24px 16px;
}

.file-viewer__pages {
  max-width: 900px;
  margin: 0 auto;
}

.file-viewer__img {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 120px);
  margin: 0 auto;
  border-radius: 4px;
}

.file-viewer__text {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  font-size: 0.8125rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.file-viewer__msg {
  margin: 80px auto;
  text-align: center;
  color: #e5e7eb;
  font-size: 0.875rem;
}

.file-viewer__msg.is-error {
  color: #fca5a5;
}

@media (max-width: 640px) {
  .files-hide-sm {
    display: none;
  }

  .files-search input {
    width: 130px;
  }

  .files-usage__note {
    margin-left: 0;
  }

  .file-viewer__actions .btn span {
    display: none;
  }
}

/* ---------- Save to My files (from a message) ---------- */
.detail-header__actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.file-save {
  gap: 6px;
}

.save-pick {
  display: grid;
  gap: 4px;
  max-height: 55vh;
  overflow-y: auto;
}

.save-pick__row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
}

.save-pick__row:hover {
  background: var(--surface-hover);
}

.save-pick__row input {
  margin-top: 3px;
  accent-color: var(--accent);
}

.save-pick__row > i {
  width: 18px;
  margin-top: 2px;
  color: var(--text-muted);
  text-align: center;
}

.save-pick__row > span {
  display: grid;
  gap: 2px;
  min-width: 0;
  font-size: 0.84375rem;
}

.save-pick__row strong {
  overflow-wrap: anywhere;
}

.save-pick__row > span > span {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.toast__action {
  margin-left: 12px;
  padding: 2px 10px;
  border: 1px solid currentColor;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

@media (max-width: 640px) {
  .file-save__label {
    display: none;
  }
}

/* ─── Documents (My files): the editor ─── */
.files-row__icon--sxdoc { color: #3e7bfa; }
body.doc-editor-open { overflow: hidden; }

.doc-editor {
  position: fixed;
  inset: 0;
  z-index: 3400;
  display: flex;
  flex-direction: column;
  background: var(--surface-sunken);
}

.doc-editor__bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.doc-editor__back {
  flex: none;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
}

.doc-editor__back:hover { background: var(--surface-hover); }
.doc-editor__back:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.doc-editor__icon { flex: none; font-size: 1.375rem; color: #3e7bfa; }

.doc-editor__title {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.doc-editor__name {
  width: 100%;
  max-width: 480px;
  padding: 2px 6px;
  margin-left: -6px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 1.0625rem;
  font-weight: 600;
}

.doc-editor__name:hover { border-color: var(--border); }
.doc-editor__name:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus-ring); }

.doc-editor__status {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.doc-editor__status[data-tone="busy"] { color: var(--text-subtle); }
.doc-editor__status[data-tone="error"] { color: var(--danger); }

.doc-editor__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.doc-editor__actions [aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); }
.doc-editor__menuwrap { position: relative; }

.doc-editor__menu {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 5;
  min-width: 230px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
}

.doc-editor__menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
  text-align: left;
  cursor: pointer;
}

.doc-editor__menu button:hover,
.doc-editor__menu button:focus-visible { background: var(--surface-hover); outline: none; }
.doc-editor__menu .fa-file-word { color: #3e7bfa; }
.doc-editor__menu .fa-file-pdf { color: #e5484d; }

.doc-editor__body {
  flex: 1;
  min-height: 0;
  display: flex;
}

.doc-editor__main {
  flex: 1;
  min-width: 0;
  overflow: auto;
}

/* The toolbar runs across the top; the page sits on the grey background like paper */
.doc-editor .sun-editor {
  border: 0;
  background: transparent;
  font-family: inherit;
}

.doc-editor .sun-editor .se-toolbar {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  outline: 0;
}

.doc-editor .sun-editor .se-wrapper {
  max-width: 816px;
  margin: 28px auto 48px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 4px 16px rgba(0, 0, 0, 0.06);
}

/* A document is white paper in light and dark mode alike (as it prints and downloads) */
.doc-editor .sun-editor .se-wrapper,
.doc-editor .sun-editor .se-wrapper-inner,
.doc-editor .sun-editor .se-wrapper-wysiwyg {
  background: #fff !important;
  color: #1f2328 !important;
}

.doc-editor .sun-editor-editable,
.doc-editor__page {
  min-height: 1056px;
  padding: 88px 96px;
  color: #1f2328;
  background: #fff;
}

.doc-editor__preview .doc-editor__page {
  max-width: 816px;
  margin: 28px auto 48px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 4px 16px rgba(0, 0, 0, 0.06);
}

.doc-editor__viewing {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 16px;
  background: var(--warning-soft);
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}

.doc-editor__viewing-actions { display: flex; gap: 8px; }

.doc-editor__history {
  flex: none;
  width: 300px;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--border);
  overflow: auto;
}

.doc-history__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 6px;
  font-size: 0.9375rem;
}

.doc-history__x {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.25rem;
  cursor: pointer;
}

.doc-history__note {
  margin: 0;
  padding: 0 16px 10px;
  font-size: 0.78125rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.doc-history__list {
  list-style: none;
  margin: 0;
  padding: 6px;
}

.doc-history__item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
  text-align: left;
  cursor: pointer;
}

.doc-history__item span { font-size: 0.78125rem; color: var(--text-muted); }
.doc-history__item:hover { background: var(--surface-hover); }
.doc-history__item:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.doc-history__item.is-current { background: var(--accent-soft); color: var(--accent-ink); }
.doc-history__empty { padding: 12px; font-size: 0.84375rem; color: var(--text-muted); }

.doc-editor__foot {
  padding: 5px 16px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Content as it's printed (PDF) and shown in Word previews */
.doc-print {
  font-family: Inter, Arial, sans-serif;
  font-size: 0.9375rem;
  line-height: 1.6;
  color: #1f2328;
  background: #fff;
}

.doc-print h1, .doc-print h2, .doc-print h3, .doc-print h4, .doc-print h5, .doc-print h6 { color: #1f2328; margin: 0.9em 0 0.4em; line-height: 1.3; }
.doc-print h1 { font-size: 2em; }
.doc-print h2 { font-size: 1.5em; }
.doc-print h3 { font-size: 1.25em; }
.doc-print p { margin: 0 0 0.75em; }
.doc-print ul, .doc-print ol { margin: 0 0 0.75em; padding-left: 1.8em; }
.doc-print ul { list-style: disc; }
.doc-print ol { list-style: decimal; }
.doc-print a { color: #1a5fd0; text-decoration: underline; }
.doc-print table { border-collapse: collapse; width: 100%; }
.doc-print td, .doc-print th { border: 1px solid #c9ccd1; padding: 6px 8px; vertical-align: top; }
.doc-print img { max-width: 100%; height: auto; }
.doc-print blockquote { margin: 0 0 0 4px; padding-left: 14px; border-left: 3px solid #c9ccd1; color: #4a4f57; }
.file-viewer__doc { max-width: 816px; margin: 0 auto; padding: 72px 80px; }

@media (max-width: 760px) {
  .doc-hide-sm { display: none; }
  .doc-editor__bar { padding: 8px 10px; gap: 6px; }
  .doc-editor__icon { display: none; }
  .doc-editor .sun-editor .se-wrapper,
  .doc-editor__preview .doc-editor__page { margin: 12px; }
  .doc-editor .sun-editor-editable,
  .doc-editor__page,
  .file-viewer__doc { min-height: 70vh; padding: 28px 22px; }
  .doc-editor__history { position: absolute; inset: 52px 0 0 auto; width: min(320px, 92vw); box-shadow: var(--shadow-lg); }
}

/* ─── My files: the New menu ─── */
.files-new { position: relative; }

.files-new__menu {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 20;
  min-width: 200px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
}

.files-new__menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
  text-align: left;
  cursor: pointer;
}

.files-new__menu button:hover,
.files-new__menu button:focus-visible { background: var(--surface-hover); outline: none; }
.files-row__icon--sxsheet { color: #1f9d55; }

/* ─── Spreadsheets: the grid fills the space under the bar ─── */
.doc-editor--sheet .doc-editor__icon { color: #1f9d55; }
.doc-editor--sheet .doc-editor__main { display: flex; flex-direction: column; overflow: hidden; }
.doc-editor--sheet .doc-editor__content { flex: 1; min-height: 0; background: #fff; }
.doc-editor--sheet .doc-editor__preview { flex: 1; min-height: 0; overflow: auto; padding: 20px; }
.sheet-editor { width: 100%; height: 100%; overflow: hidden; color: #1f2328; }
.sheet-editor .x-spreadsheet { font-family: Inter, Arial, sans-serif; }
.sheet-editor .x-spreadsheet-toolbar { background: #f8f9fb; border-bottom: 1px solid #e3e6ea; }

/* Spreadsheets as tables: version previews, Excel/CSV previews and PDFs */
.sheet-print { font-family: Inter, Arial, sans-serif; font-size: 0.75rem; color: #1f2328; background: #fff; }
.sheet-print--preview { padding: 16px 20px; border-radius: var(--radius-md); overflow: auto; max-width: 100%; }
.sheet-print__name { margin: 18px 0 8px; font-size: 0.9375rem; color: #1f2328; }
.sheet-print__name:first-child { margin-top: 0; }
.sheet-print__empty { color: #6b7280; }
.sheet-print__table { border-collapse: collapse; }
.sheet-print__table td { border: 1px solid #d0d4da; padding: 4px 8px; min-width: 48px; white-space: nowrap; }
.file-viewer__body > .sheet-print--preview { margin: 0 auto; width: fit-content; }

/* ─── PDFs: the editor ─── */
.doc-editor--pdf .doc-editor__icon { color: #e5484d; }
.doc-editor--pdf .doc-editor__main { display: flex; flex-direction: column; overflow: hidden; }
.doc-editor--pdf .doc-editor__content { flex: 1; min-height: 0; }
.doc-editor--pdf .doc-editor__preview { flex: 1; min-height: 0; overflow: auto; }
.pdfedit { display: flex; flex-direction: column; height: 100%; }
.pdfedit.is-busy { cursor: progress; }
.pdfedit.is-busy .pdfedit__body { opacity: 0.6; pointer-events: none; }

.pdfedit__tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 4px;
  padding: 6px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.pdfedit__group { display: flex; align-items: center; gap: 2px; padding-right: 8px; margin-right: 4px; border-right: 1px solid var(--border); }
.pdfedit__group:last-child { border-right: 0; }

.pdfedit__tool {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font-size: 0.875rem;
  cursor: pointer;
}

.pdfedit__tool:hover:not(:disabled) { background: var(--surface-hover); }
.pdfedit__tool:disabled { opacity: 0.35; cursor: default; }
.pdfedit__tool[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-ink); }
.pdfedit__tool:focus-visible, .pdfedit__swatch:focus-visible { outline: none; box-shadow: var(--focus-ring); }

.pdfedit__swatch {
  width: 20px;
  height: 20px;
  margin: 0 2px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--border-strong);
  cursor: pointer;
}

.pdfedit__swatch.is-on { box-shadow: 0 0 0 2px var(--accent); }

.pdfedit__select {
  height: 30px;
  padding: 0 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.8125rem;
}

.pdfedit__zoom-val {
  min-width: 52px;
  height: 30px;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.78125rem;
  cursor: pointer;
}

.pdfedit__body { flex: 1; min-height: 0; display: flex; }

.pdfedit__thumbs {
  flex: none;
  width: 196px;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow: auto;
}

.pdfedit__thumbs-head { padding: 12px 14px 4px; font-size: 0.875rem; }
.pdfedit__thumbs-count { color: var(--text-muted); font-size: 0.78125rem; }
.pdfedit__pageacts { padding: 4px 10px 8px; border-bottom: 1px solid var(--border); }
.pdfedit__pick { display: block; padding: 0 4px 2px; font-size: 0.75rem; color: var(--text-muted); }
.pdfedit__pagebtns { display: flex; flex-wrap: wrap; }
.pdfedit__addwrap { position: relative; margin-top: 6px; }
.pdfedit__add { width: 100%; justify-content: center; }

.pdfedit__addmenu {
  position: absolute;
  left: 0;
  top: calc(100% + 4px);
  z-index: 6;
  width: 240px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
}

.pdfedit__addmenu button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.84375rem;
  text-align: left;
  cursor: pointer;
}

.pdfedit__addmenu button:hover { background: var(--surface-hover); }
.pdfedit__hint { margin: 0; padding: 8px 14px 0; font-size: 0.71875rem; color: var(--text-muted); }
.pdfedit__thumbs-list { list-style: none; margin: 0; padding: 10px 14px 20px; display: grid; gap: 12px; }

.pdfedit-thumb {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;
  padding: 6px;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.75rem;
  cursor: pointer;
}

.pdfedit-thumb canvas { max-width: 110px; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2); }
.pdfedit-thumb:hover { background: var(--surface-hover); }
.pdfedit-thumb.is-picked { border-color: var(--accent); color: var(--accent-ink); }

.pdfedit__pages {
  flex: 1;
  min-width: 0;
  overflow: auto;
  padding: 24px;
  background: var(--surface-sunken);
  outline: none;
}

.pdfedit-page {
  position: relative;
  margin: 0 auto 24px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.14), 0 4px 16px rgba(0, 0, 0, 0.08);
}

.pdfedit-page canvas { display: block; width: 100%; height: 100%; }
.pdfedit-page__forms, .pdfedit-page__layer { position: absolute; inset: 0; }
.pdfedit-page__forms { pointer-events: none; }
.pdfedit-page__num { position: absolute; right: -2px; bottom: -20px; font-size: 0.71875rem; color: var(--text-muted); }
.pdfedit[data-mode="select"] .pdfedit-page__layer { pointer-events: none; }
.pdfedit[data-mode="select"] .pdfedit-obj { pointer-events: auto; }
.pdfedit:not([data-mode="select"]) .pdfedit-page__layer { cursor: crosshair; }
.pdfedit[data-mode="text"] .pdfedit-page__layer, .pdfedit[data-mode="date"] .pdfedit-page__layer { cursor: text; }

.pdfedit-field {
  position: absolute;
  pointer-events: auto;
  box-sizing: border-box;
  margin: 0;
  padding: 0 3px;
  border: 1px solid rgba(9, 105, 218, 0.45);
  border-radius: 2px;
  background: rgba(221, 236, 255, 0.55);
  color: #1f2328;
  font-family: Arial, Helvetica, sans-serif;
}

.pdfedit-field:focus { outline: 2px solid #0969da; background: rgba(255, 255, 255, 0.95); }
textarea.pdfedit-field { resize: none; padding-top: 2px; }
.pdfedit-field--check { padding: 0; accent-color: #0969da; }

.pdfedit-obj { position: absolute; box-sizing: border-box; cursor: move; }
.pdfedit-obj img, .pdfedit-obj svg { display: block; width: 100%; height: 100%; pointer-events: none; }
.pdfedit-obj.is-selected { outline: 1.5px dashed #0969da; outline-offset: 2px; }
.pdfedit-obj__text { white-space: pre-wrap; min-height: 1.2em; outline: none; cursor: inherit; }
.pdfedit-obj.is-editing { cursor: text; outline: 1.5px solid #0969da; background: rgba(255, 255, 255, 0.6); }
.pdfedit-obj.is-editing .pdfedit-obj__text { cursor: text; }

.pdfedit-obj__handle {
  position: absolute;
  right: -6px;
  bottom: -6px;
  width: 11px;
  height: 11px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #0969da;
  cursor: nwse-resize;
}

.pdfedit-obj__del {
  position: absolute;
  top: -12px;
  right: -12px;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 50%;
  background: #d1242f;
  color: #fff;
  font-size: 0.875rem;
  line-height: 1;
  cursor: pointer;
}

.pdfedit-preview { display: grid; gap: 16px; justify-items: center; padding: 20px; }
.pdfedit-preview img { max-width: min(100%, 820px); background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.14); }

.pdfedit-sign__tabs { display: flex; gap: 4px; margin-bottom: 10px; }
.pdfedit-sign__tabs button { padding: 6px 14px; border: 1px solid var(--border); border-radius: var(--radius-pill); background: transparent; color: var(--text); font: inherit; cursor: pointer; }
.pdfedit-sign__tabs [aria-selected="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); }
.pdfedit-sign__pad { display: block; width: 100%; height: auto; margin-bottom: 8px; background: #fff; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); touch-action: none; }
.pdfedit-sign__look { min-height: 64px; margin-top: 10px; padding: 8px 12px; background: #fff; color: #1b2a6b; font-size: 2.5rem; border-radius: var(--radius-sm); }

@media (max-width: 760px) {
  .pdfedit__thumbs { width: 120px; }
  .pdfedit__hint { display: none; }
  .pdfedit__pages { padding: 12px; }
}

/* ─── Documents: tools bar, page setup, header/footer, find, outline, comments, templates ─── */
.doc-editor--doc .doc-editor__content { --page-w: 794px; --page-m: 96px; --page-h: 1123px; }

.docx__bar {
  position: sticky;
  top: 0;
  z-index: 6;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  padding: 4px 10px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.docx__spacer { flex: 1; }

.docx__btn, .docx__icon {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.84375rem;
  cursor: pointer;
}

.docx__icon { width: 32px; padding: 0; justify-content: center; }
.docx__btn:hover, .docx__icon:hover { background: var(--surface-hover); }
.docx__btn:focus-visible, .docx__icon:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.docx__btn[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-ink); }
.docx__count:not(:empty) { min-width: 18px; padding: 0 5px; border-radius: var(--radius-pill); background: var(--accent); color: var(--accent-text, #fff); font-size: 0.6875rem; line-height: 18px; text-align: center; }
.docx__menuwrap { position: relative; }

.docx__menu {
  position: absolute;
  left: 0;
  top: calc(100% + 4px);
  z-index: 8;
  min-width: 250px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
}

.docx__menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
  text-align: left;
  cursor: pointer;
}

.docx__menu button:hover, .docx__menu button:focus-visible { background: var(--surface-hover); outline: none; }
.docx__menu kbd { margin-left: auto; font: 11.5px var(--font-mono); color: var(--text-muted); }

.docx__find {
  position: sticky;
  top: 41px;
  z-index: 6;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.docx__find input[type="search"], .docx__find input[type="text"] {
  height: 32px;
  width: 200px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
}

.docx__find[hidden], .docx__menu[hidden], .docx__outline[hidden], .docx__comments[hidden] { display: none; }
.docx__check { display: inline-flex; align-items: center; gap: 5px; font-size: 0.8125rem; color: var(--text-muted); }
.docx__find-n { min-width: 70px; font-size: 0.78125rem; color: var(--text-muted); }
::highlight(sx-find) { background-color: rgba(255, 213, 0, 0.45); }
::highlight(sx-find-current) { background-color: rgba(255, 140, 0, 0.75); }

/* The page follows its setup: width, margins; header and footer bands */
.doc-editor--doc .sun-editor .se-wrapper { max-width: var(--page-w); }
.doc-editor--doc .sun-editor-editable { padding: 12px var(--page-m) 24px; min-height: calc(var(--page-h) - 2 * var(--page-m)); }

.docx__band {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 24px;
  padding: calc(var(--page-m) * 0.45) var(--page-m) 8px;
  color: #6b7280;
  font: 12px Arial, sans-serif;
  cursor: pointer;
}

.docx__band--bottom { padding: 8px var(--page-m) calc(var(--page-m) * 0.45); }
.docx__band:hover { background: #f6f8fa; }
.docx__band.is-empty span:first-child::before { content: "Click to add a header"; opacity: 0; }
.docx__band--bottom.is-empty span:first-child::before { content: "Click to add a footer"; }
.docx__band.is-empty:hover span:first-child::before { opacity: 0.7; }
.docx__pn--c { margin: 0 auto; }

.sun-editor-editable hr.sx-page-break, .doc-print hr.sx-page-break, .doc-editor__page hr.sx-page-break {
  position: relative;
  height: 0;
  margin: 28px calc(-1 * var(--page-m, 0px));
  border: 0;
  border-top: 2px dashed #c9ccd1;
  overflow: visible;
}

.sun-editor-editable hr.sx-page-break::after, .doc-editor__page hr.sx-page-break::after {
  content: "Page break";
  position: absolute;
  left: 50%;
  top: -10px;
  transform: translateX(-50%);
  padding: 0 8px;
  background: #fff;
  color: #8b929b;
  font: 11px Arial, sans-serif;
}

.doc-print hr.sx-page-break { page-break-after: always; break-after: page; margin: 0; border: 0; }
.sx-toc { margin: 8px 0 16px; padding: 10px 14px; border: 1px solid #e3e6ea; border-radius: 6px; background: #fafbfc; }
.sx-toc::before { content: "Contents"; display: block; font-weight: 700; }
.doc-print .sx-toc::before { content: none; }
.sx-toc ul { list-style: none; margin: 4px 0 0; padding: 0; }
.sx-toc .sx-toc-h2 { padding-left: 18px; }
.sx-toc .sx-toc-h3 { padding-left: 36px; }
.sx-toc a { color: #1a5fd0; text-decoration: none; }
.doc-print .sx-toc { background: none; border: 0; padding: 0; }
.sun-editor-editable span.sx-comment { background: rgba(255, 213, 0, 0.35); border-bottom: 2px solid #e3b300; cursor: pointer; }
.sun-editor-editable span.sx-comment.is-active { background: rgba(255, 170, 0, 0.55); }

.docx__outline, .docx__comments {
  flex: none;
  width: 250px;
  overflow: auto;
  background: var(--surface);
  border-right: 1px solid var(--border);
}

.docx__comments { width: 300px; border-right: 0; border-left: 1px solid var(--border); }
.docx__side-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 10px 6px 16px; font-size: 0.9375rem; }
.docx__side-empty { margin: 0; padding: 6px 16px; font-size: 0.8125rem; color: var(--text-muted); }
.docx__outline-list, .docx__comment-list { list-style: none; margin: 0; padding: 4px 8px 16px; }

.docx__outline-item {
  display: block;
  width: 100%;
  padding: 6px 8px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.84375rem;
  text-align: left;
  cursor: pointer;
}

.docx__outline-item:hover { background: var(--surface-hover); }
.docx__outline-item--h1 { font-weight: 600; }
.docx__outline-item--h2 { padding-left: 20px; }
.docx__outline-item--h3 { padding-left: 34px; color: var(--text-muted); }
.docx__add-comment { margin: 0 16px 8px; }

.docx__comment {
  margin-bottom: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  cursor: pointer;
}

.docx__comment.is-active { border-color: #e3b300; box-shadow: 0 0 0 2px rgba(227, 179, 0, 0.25); }
.docx__comment.is-resolved { opacity: 0.7; }
.docx__comment blockquote { margin: 0 0 6px; padding-left: 8px; border-left: 3px solid #e3b300; color: var(--text-muted); font-size: 0.78125rem; }
.docx__comment-text { margin: 0 0 4px; font-size: 0.875rem; white-space: pre-wrap; }
.docx__comment-by, .docx__comment-note { margin: 0 0 8px; font-size: 0.71875rem; color: var(--text-muted); }
.docx__comment-acts { display: flex; flex-wrap: wrap; gap: 6px; }
.docx__resolved { padding: 0 8px 12px; font-size: 0.8125rem; }
.docx__resolved summary { padding: 6px 8px; cursor: pointer; color: var(--text-muted); }
.docx__form { display: grid; gap: 12px; }
.docx__field { display: grid; gap: 4px; font-size: 0.84375rem; }

.doc-templates { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }

.doc-template {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.doc-template i { font-size: 1.25rem; color: #3e7bfa; margin-bottom: 4px; }
.doc-template strong { font-size: 0.875rem; }
.doc-template span { font-size: 0.78125rem; color: var(--text-muted); }
.doc-template:hover { background: var(--surface-hover); }
.doc-template[aria-checked="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }

@media (max-width: 760px) {
  .docx__btn { padding: 0 8px; font-size: 0; gap: 0; }
  .docx__btn i { font-size: 0.875rem; }
  .docx__count:not(:empty) { font-size: 0.6875rem; }
  .docx__outline, .docx__comments { position: absolute; z-index: 9; top: 0; bottom: 0; box-shadow: var(--shadow-lg); }
  .docx__comments { right: 0; }
  .docx__find input[type="search"], .docx__find input[type="text"] { width: 140px; }
}

/* ─── Images ─── */
.files-row__icon--sxslides { color: #d9730d; }
.files-row__icon--txt { color: #6b7280; }
.doc-editor--image .doc-editor__icon { color: #8250df; }
.doc-editor--image .doc-editor__main, .doc-editor--text .doc-editor__main, .doc-editor--slides .doc-editor__main { display: flex; flex-direction: column; overflow: hidden; }
.doc-editor--image .doc-editor__content, .doc-editor--text .doc-editor__content, .doc-editor--slides .doc-editor__content { flex: 1; min-height: 0; }
.doc-editor--image .doc-editor__preview, .doc-editor--text .doc-editor__preview, .doc-editor--slides .doc-editor__preview { flex: 1; min-height: 0; overflow: auto; }
.imgedit { display: flex; flex-direction: column; height: 100%; }
.imgedit__cropbar { display: flex; align-items: center; gap: 10px; padding: 8px 14px; background: var(--warning-soft); border-bottom: 1px solid var(--border); font-size: 0.84375rem; }
.imgedit__cropbar span { margin-right: auto; }
.imgedit__body { flex: 1; min-height: 0; display: flex; }

.imgedit__stage {
  flex: 1;
  min-width: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  background-color: var(--surface-sunken);
  background-image: linear-gradient(45deg, rgba(127, 127, 127, 0.12) 25%, transparent 25%, transparent 75%, rgba(127, 127, 127, 0.12) 75%), linear-gradient(45deg, rgba(127, 127, 127, 0.12) 25%, transparent 25%, transparent 75%, rgba(127, 127, 127, 0.12) 75%);
  background-size: 20px 20px;
  background-position: 0 0, 10px 10px;
}

.imgedit__canvas { box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25); touch-action: none; }
.imgedit[data-mode="select"] .imgedit__canvas { cursor: default; }
.imgedit:not([data-mode="select"]) .imgedit__canvas { cursor: crosshair; }

.imgedit__adjust {
  flex: none;
  width: 230px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  overflow: auto;
  font-size: 0.84375rem;
}

.imgedit__slider { display: grid; gap: 4px; color: var(--text-muted); }
.imgedit__slider input { width: 100%; accent-color: var(--accent); }
.imgedit__adjust-acts { display: flex; gap: 8px; }
.imgedit__size { margin: 6px 0 0; color: var(--text-muted); font-size: 0.78125rem; }

/* ─── Text and code ─── */
.doc-editor--text .doc-editor__icon { color: #6b7280; }
.textedit { display: flex; flex-direction: column; height: 100%; }
.textedit__lang { padding: 2px 8px; margin-right: 6px; border-radius: var(--radius-pill); background: var(--surface-sunken); color: var(--text-muted); font-size: 0.75rem; font-weight: 600; }
.textedit__check { font-size: 0.78125rem; }
.textedit__check[data-tone="ok"] { color: var(--success); }
.textedit__check[data-tone="error"] { color: var(--danger); }
.textedit__views { display: inline-flex; gap: 2px; }
.textedit__views [aria-checked="true"] { background: var(--accent-soft); color: var(--accent-ink); }
.textedit__body { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr; }
.textedit__body[data-view="split"] { grid-template-columns: 1fr 1fr; }
.textedit__body[data-view="preview"] .textedit__code { display: none; }
.textedit__body[data-view="edit"] .textedit__preview { display: none; }
.textedit__code { min-width: 0; min-height: 0; position: relative; }
.textedit__code .CodeMirror { position: absolute; inset: 0; height: auto; font: 14px/1.55 var(--font-mono), Menlo, Consolas, monospace; }
.textedit__code .CodeMirror-dialog input { font: inherit; }
.textedit__preview { overflow: auto; padding: 32px 40px; border-left: 1px solid var(--border); }
.textedit__preview pre, .doc-print pre { padding: 10px 12px; background: #f6f8fa; border-radius: 6px; overflow: auto; }
.textedit__preview code, .doc-print code { font-family: var(--font-mono), Menlo, Consolas, monospace; font-size: 0.92em; }
.textedit__preview table, .doc-print table { border-collapse: collapse; }
.textedit__preview th, .textedit__preview td { border: 1px solid #d0d4da; padding: 4px 8px; }
.textedit__old { margin: 20px; padding: 16px; background: var(--surface); color: var(--text); border-radius: var(--radius-md); white-space: pre-wrap; font: 13px/1.5 var(--font-mono), monospace; }

/* ─── Presentations ─── */
.doc-editor--slides .doc-editor__icon { color: #d9730d; }
.slides { display: flex; flex-direction: column; height: 100%; }
.slides__body { flex: 1; min-height: 0; display: flex; }
.slides__side { flex: none; width: 210px; display: flex; flex-direction: column; background: var(--surface); border-right: 1px solid var(--border); overflow: auto; }
.slides__sidebtns { padding: 0 10px 8px; border-bottom: 1px solid var(--border); }
.slides__list { list-style: none; margin: 0; padding: 10px 12px 20px; display: grid; gap: 10px; }

.slides__thumb {
  display: flex;
  gap: 6px;
  width: 100%;
  padding: 4px;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.75rem;
  cursor: pointer;
}

.slides__thumb.is-current { border-color: var(--accent); color: var(--accent-ink); }
.slides__thumb-n { width: 14px; text-align: right; }
.slides__thumb-frame { position: relative; display: block; width: 160px; height: 90px; overflow: hidden; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); pointer-events: none; }
.slides__thumb-frame .slide-canvas { transform: scale(0.125); transform-origin: 0 0; }
.slides__main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--surface-sunken); }
.slides__stage { flex: 1; min-height: 0; display: grid; place-items: center; overflow: hidden; outline: none; }
.slides__canvas { position: relative; box-shadow: 0 2px 14px rgba(0, 0, 0, 0.25); }
.slides__canvas .slide-canvas { transform-origin: 0 0; }
.slides__noteswrap { display: grid; gap: 4px; padding: 8px 16px 12px; background: var(--surface); border-top: 1px solid var(--border); font-size: 0.78125rem; color: var(--text-muted); }
.slides__notes { width: 100%; resize: vertical; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font: inherit; font-size: 0.875rem; }
.slides__tools .docx__btn { height: 30px; }

.slide-canvas { position: relative; overflow: hidden; font-family: Inter, Arial, sans-serif; }
.slide-el { position: absolute; box-sizing: border-box; line-height: 1.25; }
.slide-el__text { width: 100%; height: 100%; overflow: hidden; outline: none; word-wrap: break-word; }
.slide-el__text ul, .slide-el__text ol { margin: 0; padding-left: 1.2em; }
.slide-el__text li { margin: 0.2em 0; }
.slide-el img { display: block; width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.slides__canvas .slide-el { cursor: move; }
.slides__canvas .slide-el--text:not(.is-selected) { outline: 1px dashed transparent; }
.slides__canvas .slide-el--text:hover { outline: 1px dashed rgba(9, 105, 218, 0.5); }
.slides__canvas .slide-el.is-selected { outline: 3px solid #0969da; }
.slides__canvas .slide-el.is-editing { cursor: text; outline: 3px solid #0969da; }
.slides__canvas .slide-el.is-editing .slide-el__text { overflow: visible; }
.slide-el__handle { position: absolute; right: -12px; bottom: -12px; width: 22px; height: 22px; border: 4px solid #fff; border-radius: 50%; background: #0969da; cursor: nwse-resize; }

.slides-preview { display: grid; grid-template-columns: repeat(auto-fill, 384px); justify-content: center; gap: 18px; padding: 20px; }
.slides-preview__item { margin: 0; }
.slides-preview__frame { position: relative; width: 384px; height: 216px; overflow: hidden; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25); }
.slides-preview__frame .slide-canvas { transform: scale(0.3); transform-origin: 0 0; }
.slides-preview figcaption { margin-top: 6px; font-size: 0.75rem; color: var(--text-muted); }
.file-viewer__body > .slides-preview { max-width: 1200px; margin: 0 auto; }

.slides-show { position: fixed; inset: 0; z-index: 5000; display: grid; place-items: center; background: #000; outline: none; cursor: pointer; }
.slides-show__stage { position: relative; width: 100vw; height: 100vh; display: grid; place-items: center; overflow: hidden; }
.slides-show__stage .slide-canvas { flex: none; transform-origin: center; }
.slides-show__bar { position: fixed; right: 16px; bottom: 14px; display: flex; align-items: center; gap: 6px; padding: 4px 6px; border-radius: var(--radius-pill); background: rgba(0, 0, 0, 0.55); color: #fff; font-size: 0.8125rem; opacity: 0.25; transition: opacity 0.2s; }
.slides-show:hover .slides-show__bar { opacity: 1; }
.slides-show__bar button { padding: 6px 10px; border: 0; border-radius: var(--radius-pill); background: transparent; color: #fff; font: inherit; cursor: pointer; }
.slides-show__bar button:hover { background: rgba(255, 255, 255, 0.15); }

@media (max-width: 760px) {
  .imgedit__adjust { display: none; }
  .slides__side { width: 120px; }
  .slides__thumb-frame { width: 96px; height: 54px; }
  .slides__thumb-frame .slide-canvas { transform: scale(0.075); }
  .textedit__body[data-view="split"] { grid-template-columns: 1fr; }
  .textedit__body[data-view="split"] .textedit__preview { display: none; }
}

/* ─── Compare ─── */
.cmp { max-width: 1400px; margin: 0 auto; color: var(--text); }
.file-viewer__body > .cmp { background: var(--surface); border-radius: var(--radius-md); padding: 12px; }
.doc-editor__preview > .cmp { padding: 16px; }
.cmp__summary { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 0 0 10px; font-size: 0.875rem; }
.cmp__key { display: inline-flex; gap: 8px; font-size: 0.75rem; }
.cmp__k { padding: 2px 8px; border-radius: var(--radius-pill); }
.cmp__k--del { background: rgba(209, 36, 47, 0.15); color: #b42318; }
.cmp__k--ins { background: rgba(31, 136, 61, 0.15); color: #1a7f37; }
.cmp__table { width: 100%; border-collapse: collapse; table-layout: fixed; font: 13px/1.5 var(--font-mono), Menlo, Consolas, monospace; background: var(--surface); }
.cmp__table col.cmp__n { width: 48px; }
.cmp__table th { position: sticky; top: 0; padding: 8px 10px; background: var(--surface-sunken); border-bottom: 1px solid var(--border); font: 600 13px Inter, sans-serif; text-align: left; }
.cmp__table td { padding: 1px 8px; vertical-align: top; white-space: pre-wrap; word-break: break-word; border-bottom: 1px solid transparent; }
.cmp__table td.cmp__n { color: var(--text-muted); text-align: right; user-select: none; background: var(--surface-sunken); }
.cmp__row--removed .cmp__a, .cmp__row--changed .cmp__a { background: rgba(209, 36, 47, 0.1); }
.cmp__row--added .cmp__b, .cmp__row--changed .cmp__b { background: rgba(31, 136, 61, 0.1); }
.cmp__row--removed .cmp__b, .cmp__row--added .cmp__a { background: repeating-linear-gradient(135deg, transparent 0 6px, rgba(127, 127, 127, 0.08) 6px 12px); }
.cmp__table del { background: rgba(209, 36, 47, 0.3); color: inherit; text-decoration: line-through; }
.cmp__table ins { background: rgba(31, 136, 61, 0.3); color: inherit; text-decoration: none; }
.cmp__fold td { padding: 6px; text-align: center; color: var(--text-muted); background: var(--surface-sunken); font: 12px Inter, sans-serif; }
.doc-editor__viewing-actions [aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); }

/* ─── My files: search inside, snippets, gallery ─── */
.files-searchwrap { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.files-inside { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8125rem; color: var(--text-muted); white-space: nowrap; cursor: pointer; }
.files-inside input { accent-color: var(--accent); }
.files-row__snippet { display: block; margin-top: 2px; font-size: 0.78125rem; color: var(--text-muted); white-space: normal; text-align: left; }
.files-row__snippet mark { background: rgba(255, 213, 0, 0.45); color: inherit; border-radius: 2px; }
.files-gallery { display: grid; gap: 16px; }
.ui-dialog__panel.ui-dialog__panel--wide { width: min(760px, calc(100vw - 32px)); max-width: none; }
.files-gallery__group h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-size: 0.875rem; }
.files-gallery .doc-template i.files-row__icon--sxsheet { color: #1f9d55; }
.files-gallery .doc-template i.files-row__icon--sxslides { color: #d9730d; }
.files-gallery .doc-template i.files-row__icon--txt { color: #6b7280; }

/* ---------- (SecurelyX app) Plan: sidebar meter, locked tools, limit messages ---------- */
.plan-meter {
  display: grid;
  gap: 6px;
  margin: 0 12px 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-sunken);
  font-size: 0.78125rem;
  color: var(--text-muted);
  flex-shrink: 0;
}
.plan-meter__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.plan-meter__name { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--text); }
.plan-meter__name i { color: var(--accent-ink); }
.plan-meter__seats { font-weight: 500; color: var(--text-subtle); }
.plan-meter__link { padding: 0; border: 0; background: none; font: inherit; font-weight: 600; color: var(--accent-ink); text-decoration: none; cursor: pointer; }
.plan-meter__link:hover { text-decoration: underline; text-underline-offset: 2px; }
.plan-meter__link:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: 4px; }
.plan-meter__row { display: flex; justify-content: space-between; gap: 8px; }
.plan-meter__row span:last-child { font-variant-numeric: tabular-nums; color: var(--text); }
.plan-meter__bar { height: 5px; border-radius: var(--radius-pill); background: var(--border); overflow: hidden; }
.plan-meter__bar span { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.plan-meter__bar.is-full span { background: var(--warning); }
.plan-meter__note { margin: 0; color: var(--text-subtle); }
.plan-meter__note--warn { color: var(--warning); }
.plan-lock { margin-left: 2px; font-size: 0.6875rem; color: var(--text-subtle); }
.is-plan-locked .plan-lock i { color: var(--text-subtle); }
.plan-upsell { margin: 0 0 4px; color: var(--text-muted); font-size: 0.875rem; line-height: 1.55; }
.toast-link { margin-left: 6px; color: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.compose-from__me { color: var(--text); font-size: 0.875rem; }
.compose-from__upsell { margin-left: auto; padding: 0; border: 0; background: none; font: inherit; font-size: 0.8125rem; color: var(--text-subtle); cursor: pointer; }
.compose-from__upsell:hover { color: var(--accent-ink); text-decoration: underline; }
/* (SecurelyX app: storage plans) Compose: message storage is full */
.plan-storage-notice { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; margin: 0 0 14px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-md, 10px); background: var(--warning-soft); color: var(--text); font-size: 0.875rem; line-height: 1.5; }
.plan-storage-notice > i { color: var(--warning); }
.plan-storage-notice p { flex: 1 1 260px; margin: 0; }
.plan-storage-notice__actions { display: flex; gap: 8px; flex-wrap: wrap; }
/* (SecurelyX app: plan changes) Over the plan's storage: under the workspace's top bar, and in My files */
.plan-over-banner { margin: 12px 20px 0; }
@media (max-width: 640px) { .plan-over-banner { margin: 10px 16px 0; } }
.files-limit { margin: 10px 0 0; }
/* Plan and billing: storage bars and the largest messages */
.profile-usage { display: grid; gap: 14px; margin: 4px 0 6px; }
.profile-usage__row { display: grid; gap: 6px; }
.profile-usage__head { display: flex; justify-content: space-between; gap: 8px; font-size: 0.875rem; }
.profile-usage__head span:last-child { font-variant-numeric: tabular-nums; color: var(--text-muted); }
.profile-usage__bar { height: 8px; border-radius: var(--radius-pill); background: var(--border); overflow: hidden; }
.profile-usage__bar span { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.profile-usage__bar.is-near span { background: var(--warning); }
.profile-largest { margin-top: 6px; }
.profile-largest h3 { margin: 0 0 8px; font-size: 0.9375rem; }
.profile-largest__list { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.profile-largest__row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-md, 10px); background: var(--surface); }
.profile-largest__what { flex: 1; min-width: 0; display: grid; }
.profile-largest__what strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: 0.875rem; }
.profile-largest__what span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-subtle); font-size: 0.8125rem; }
.profile-largest__size { font-variant-numeric: tabular-nums; color: var(--text-muted); font-size: 0.8125rem; white-space: nowrap; }
.profile-largest__btns { display: flex; gap: 6px; }
@media (max-width: 560px) { .profile-largest__row { flex-wrap: wrap; } .profile-largest__btns { width: 100%; justify-content: flex-end; } }
