.editor-page {
  color: #fff;
}

.editor-shell {
  position: relative;
  overflow: hidden;
  height: 100vh;
}

.editor-content {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.editor-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.editor-header-title {
  min-width: 0;
  flex: 1 1 auto;
}

.editor-header-email {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-width: 0;
  flex-wrap: nowrap;
}

.editor-header-email-copy {
  min-width: 0;
  flex: 1 1 auto;
}

.editor-header-avatar {
  width: 3rem;
  height: 3rem;
  font-size: 1rem;
}

.editor-record-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.editor-header-kicker {
  margin-bottom: 0.35rem;
  color: rgba(124, 196, 255, 0.9);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.editor-header-meta {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  min-width: 0;
  color: rgba(255, 255, 255, 0.82);
}

.editor-header-meta-label {
  flex: 0 0 auto;
  color: rgba(255, 255, 255, 0.46);
  font-size: 0.74rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.editor-header-meta-value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.editor-header-actions {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 0.85rem;
  flex-wrap: wrap;
  min-width: 0;
}

.editor-view-tabs {
  margin-bottom: 1rem;
}

.editor-tab-link {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}

.editor-page .sidebar-link.editor-tab-link {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}

.editor-tab-link span {
  width: auto;
  white-space: nowrap;
}

.editor-page .sidebar-link.editor-tab-link span {
  width: auto;
  white-space: nowrap;
}

.editor-page button.sidebar-link.editor-tab-link {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.editor-page button.sidebar-link.editor-tab-link::-moz-focus-inner {
  border: 0;
  padding: 0;
}

.editor-tab-scroll {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overflow-x: hidden;
  scrollbar-gutter: auto;
}

.editor-tab-scroll > .editor-form,
.editor-tab-scroll > .attachments-layout {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  min-height: 100%;
}

.attachments-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 1.25rem;
  height: 100%;
  min-height: 0;
  align-items: stretch;
  width: 100%;
}

.attachments-layout > .editor-section,
.attachments-layout > .pdf-preview-panel {
  min-height: 0;
  overflow: hidden;
  isolation: isolate;
  background-clip: padding-box;
}

.attachments-result-section {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  flex: 1 1 auto;
  min-height: 0;
}

.attachments-result-section .results-strip {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 0.15rem 0 0;
}

.attachments-result-section .result-card {
  flex: none;
  width: 100%;
}

.attachments-result-section .results-strip > .result-card.is-active {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  align-self: stretch;
  min-height: 0;
}

.attachments-preview-panel {
  min-height: 0;
}

.attachments-preview-panel.pdf-viewer {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  overflow: hidden;
}

.attachments-preview-panel.pdf-viewer > .pdf-frame {
  min-height: 0;
  height: 100%;
  width: 100%;
  max-width: 100%;
}

.attachments-preview-panel.pdf-viewer > .pdf-empty-state-text {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  margin: 0;
  padding: 1.25rem;
}

.editor-form {
  margin-top: 0;
  min-width: 0;
  min-height: 0;
}

.editor-form > .editor-info-grid {
  min-height: 0;
}

.editor-info-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1.25rem;
  min-width: 0;
  align-items: stretch;
}

.editor-section {
  padding: 1.25rem;
  border-radius: 1.25rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.025);
}

.editor-info-grid > .editor-section {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  padding: 1.25rem;
  border-radius: 1.25rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.025);
  backdrop-filter: none;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.14);
  isolation: isolate;
  background-clip: padding-box;
}

.editor-identifiers-section {
  min-height: 0;
}

.editor-scroll-panel {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  max-height: 100%;
  overflow: auto;
  overflow-x: hidden;
  padding-right: 0.15rem;
  scrollbar-gutter: stable;
}

.attachments-layout > .editor-section {
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.14);
}

.editor-email-section {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.section-header h2 {
  letter-spacing: -0.02em;
}

.editor-info-grid > .editor-section > .section-header {
  padding-bottom: 0.9rem;
  margin-bottom: 1rem !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.editor-info-grid > .editor-section > .editor-grid {
  flex: 1 1 auto;
}

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

.editor-field-wide {
  grid-column: 1 / -1;
}

.editor-field {
  display: grid;
  gap: 0.45rem;
  min-width: 0;
  min-height: 0;
}

.editor-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: rgba(255, 255, 255, 0.5);
}

.email-client-header {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  min-width: 0;
}

.email-client-avatar {
  flex: 0 0 auto;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(124, 196, 255, 0.35), rgba(78, 166, 255, 0.12));
  border: 1px solid rgba(124, 196, 255, 0.28);
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.email-client-meta {
  min-width: 0;
  flex: 1 1 auto;
}

.email-client-meta-label,
.email-client-subject-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: rgba(255, 255, 255, 0.46);
}

.email-client-meta-value,
.email-client-subject {
  min-width: 0;
  color: #fff;
  font-size: 1rem;
  line-height: 1.35;
  word-break: break-word;
}

.email-client-pill {
  flex: 0 0 auto;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  background: rgba(78, 166, 255, 0.12);
  border: 1px solid rgba(78, 166, 255, 0.18);
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.email-client-subject-block {
  display: grid;
  gap: 0.35rem;
  padding-top: 0.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.email-client-body {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  max-height: none;
  padding: 0;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.9);
  white-space: pre-wrap;
  line-height: 1.7;
  overflow: auto;
}

.editor-input,
.editor-textarea {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
  border-radius: 0.95rem;
  padding: 0.95rem 1rem;
  box-sizing: border-box;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.editor-input {
  height: 3.25rem;
}

.searchable-select {
  position: relative;
}

.searchable-select-trigger {
  appearance: none;
  -webkit-appearance: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  text-align: left;
  cursor: pointer;
  line-height: 1.2;
}

.searchable-select-trigger-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.searchable-select-trigger-caret {
  flex: none;
  opacity: 0.75;
  transition: transform 0.18s ease;
}

.searchable-select.is-open .searchable-select-trigger-caret {
  transform: rotate(180deg);
}

.searchable-select-panel {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  right: 0;
  z-index: 20;
  padding: 0.9rem;
  background: rgba(8, 18, 34, 0.96);
  border: 1px solid var(--panel-border);
  border-radius: 1rem;
  box-shadow: 0 26px 60px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(18px);
}

.searchable-select-search {
  margin-bottom: 0.75rem;
}

.searchable-select-options {
  display: grid;
  gap: 0.35rem;
  max-height: 16rem;
  overflow: auto;
}

.searchable-select-option {
  appearance: none;
  -webkit-appearance: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
  border: 0;
  border-radius: 0.85rem;
  padding: 0.8rem 0.95rem;
  background: transparent;
  color: #fff;
  text-align: left;
}

.searchable-select-option:hover,
.searchable-select-option:focus-visible,
.searchable-select-option.is-selected {
  background: rgba(78, 166, 255, 0.14);
  outline: none;
}

.searchable-select-option-label {
  min-width: 0;
}

.searchable-select-option-value {
  flex: none;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
}

.searchable-select-empty {
  padding: 0.85rem 0.95rem 0.3rem;
  color: var(--text-soft);
}

.editor-textarea {
  resize: vertical;
  min-height: 8.5rem;
}

.editor-readonly-multiline {
  min-height: 8.5rem;
  height: auto;
  overflow: auto;
  white-space: pre-wrap;
  line-height: 1.7;
  cursor: default;
}

.confidence-reason-block {
  display: grid;
  gap: 0.75rem;
  align-content: start;
}

.confidence-reason-section {
  display: grid;
  gap: 0.35rem;
  color: rgba(255, 255, 255, 0.9);
  word-break: break-word;
  overflow-wrap: anywhere;
  line-height: 1.7;
  white-space: pre-wrap;
}

.confidence-reason-section + .confidence-reason-section {
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.confidence-reason-section-heading {
  color: var(--brand-cyan);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.2;
}

.confidence-reason-section-primary .confidence-reason-section-heading {
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.08em;
}

.confidence-reason-section-body {
  color: rgba(255, 255, 255, 0.92);
  white-space: pre-wrap;
  line-height: 1.75;
}

.editor-input::placeholder,
.editor-textarea::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.editor-input:focus,
.editor-textarea:focus {
  outline: none;
  border-color: rgba(124, 196, 255, 0.55);
  box-shadow: 0 0 0 0.25rem rgba(78, 166, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
}

.editor-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.85rem;
}

.editor-actions .primary-action,
.editor-actions .secondary-action {
  height: 3.25rem;
  padding: 0 1rem;
  box-sizing: border-box;
}

.editor-cancel-btn {
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.editor-cancel-btn:hover,
.editor-cancel-btn:focus-visible {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(124, 196, 255, 0.16);
}

.secondary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  border-radius: 0.95rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
  font-weight: 700;
}

.editor-save-button {
  width: auto;
  min-width: 0;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

.editor-workspace {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.editor-workspace-scroll {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  overflow-x: hidden;
  scrollbar-gutter: stable;
}

.editor-form-panel {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 1.25rem;
  height: auto;
  min-width: 0;
  min-height: 0;
  box-sizing: border-box;
  background: rgba(8, 18, 34, 0.68);
  border: 1px solid var(--panel-border);
  border-radius: 1.5rem;
  backdrop-filter: blur(18px);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.24);
}

.editor-form {
  margin-top: 0;
}

.results-section {
  margin-top: 0;
}

.save-review-modal {
  position: fixed;
  inset: 0;
  z-index: 1150;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.save-review-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 8, 16, 0.72);
}

.save-review-modal-panel {
  position: relative;
  z-index: 1;
  width: min(46rem, calc(100vw - 2rem));
  max-height: min(80vh, 52rem);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.35rem;
  border-radius: 1.5rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(8, 18, 34, 0.96);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.4);
  overflow: hidden;
}

.save-review-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.save-review-modal-body {
  display: grid;
  gap: 1rem;
  min-height: 0;
  overflow: auto;
  padding-right: 0.2rem;
}

.save-review-modal-summary {
  color: rgba(255, 255, 255, 0.84);
  font-size: 0.98rem;
  line-height: 1.6;
}

.save-review-modal-changes {
  display: grid;
  gap: 0.7rem;
}

.save-review-change {
  display: grid;
  gap: 0.35rem;
  padding: 0.85rem 0.95rem;
  border-radius: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

.save-review-change-label {
  color: #fff;
  font-size: 0.92rem;
  font-weight: 700;
}

.save-review-change-values {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  min-width: 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.9rem;
  line-height: 1.5;
  flex-wrap: wrap;
}

.save-review-change-value {
  min-width: 0;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.save-review-change-old {
  color: rgba(255, 255, 255, 0.65);
}

.save-review-change-new {
  color: #fff;
}

.save-review-change-arrow {
  color: rgba(124, 196, 255, 0.9);
  flex: none;
}

.save-review-change-empty {
  padding: 0.9rem 1rem;
  border-radius: 1rem;
  border: 1px dashed rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.75);
}

.save-review-modal-notes {
  margin-top: 0.25rem;
}

.save-review-textarea {
  min-height: 7.5rem;
  resize: vertical;
}

.save-review-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.review-summary-card {
  display: grid;
  gap: 0.45rem;
  padding: 1rem 1.05rem;
  border-radius: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

.review-summary-label {
  color: rgba(255, 255, 255, 0.56);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.review-summary-value {
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.98rem;
  line-height: 1.65;
  word-break: break-word;
  overflow-wrap: anywhere;
}

@media (max-width: 992px) {
  .editor-header {
    flex-direction: column;
    align-items: stretch;
  }

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

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

  .editor-field-wide {
    grid-column: auto;
  }

  .editor-info-grid {
    grid-template-columns: 1fr;
  }

  .attachments-layout {
    grid-template-columns: 1fr;
  }

  .editor-workspace {
    flex-direction: column;
  }

  .editor-tab-link {
    align-items: flex-start;
  }
}

@media (max-width: 768px) {
  .editor-content {
    padding: 1.1rem;
  }

  .editor-section {
    padding: 1rem;
  }

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

  .editor-save-button,
  .secondary-action {
    width: 100%;
  }

  .save-review-modal-panel {
    width: min(100vw - 1.5rem, 46rem);
  }

  .save-review-modal-footer {
    justify-content: stretch;
  }

  .save-review-modal-footer > * {
    width: 100%;
  }

  .editor-tab-link {
    width: 100%;
  }
}
