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

.inbox-header,
.inbox-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.header-meta {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.meta-pill,
.compose-link,
.search-shell,
.message-tag {
  border-radius: 999px;
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1rem;
  border: 1px solid rgba(124, 196, 255, 0.22);
  background: rgba(124, 196, 255, 0.08);
  color: #d6ecff;
  white-space: nowrap;
}

.live-pill-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: #7cc4ff;
  box-shadow: 0 0 0 0 rgba(124, 196, 255, 0.35);
  animation: live-pulse 1.5s ease-in-out infinite;
}

@keyframes live-pulse {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(124, 196, 255, 0.3);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 8px rgba(124, 196, 255, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(124, 196, 255, 0);
  }
}

.mail-row.is-processing {
  cursor: not-allowed;
  opacity: 0.92;
}

.mail-row.is-processing:hover {
  transform: none;
  background: rgba(255, 255, 255, 0.025);
  border-color: rgba(255, 255, 255, 0.06);
}

.meta-pill,
.compose-link {
  padding: 0.7rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.03);
  color: #fff;
}

.compose-link {
  text-decoration: none;
  font-weight: 700;
  white-space: nowrap;
}

.search-shell {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.95rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.03);
  color: rgba(255, 255, 255, 0.55);
}

.search-icon {
  font-size: 1rem;
  line-height: 1;
  color: rgba(255, 255, 255, 0.45);
}

.message-list {
  margin-top: 0.25rem;
}

.message-row {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: start;
  padding: 1rem 1rem 1rem 0.85rem;
  border-radius: 1.1rem;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.025);
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.message-row:hover {
  transform: translateY(-1px);
  border-color: rgba(124, 196, 255, 0.18);
  background: rgba(255, 255, 255, 0.04);
}

.message-row.unread .message-subject,
.message-row.unread .message-topline strong {
  color: #fff;
}

.message-status {
  width: 10px;
  height: 10px;
  margin-top: 0.35rem;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(124, 196, 255, 0.12);
}

.message-status.muted {
  background: rgba(255, 255, 255, 0.3);
  box-shadow: none;
}

.message-main {
  min-width: 0;
}

.message-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.92rem;
}

.message-subject {
  margin-top: 0.35rem;
  margin-bottom: 0.3rem;
  font-size: 1.02rem;
  color: rgba(255, 255, 255, 0.88);
}

.message-snippet {
  color: rgba(255, 255, 255, 0.56);
  line-height: 1.45;
}

.message-tag {
  align-self: start;
  padding: 0.45rem 0.8rem;
  border: 1px solid rgba(124, 196, 255, 0.16);
  background: rgba(124, 196, 255, 0.08);
  color: #d6ecff;
  font-size: 0.82rem;
  white-space: nowrap;
}

.message-tag.soft {
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: rgba(255, 255, 255, 0.75);
}

@media (max-width: 992px) {
  .inbox-layout {
    grid-template-columns: 1fr;
  }

  .inbox-sidebar {
    min-height: auto;
  }
}

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

  .inbox-header,
  .inbox-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

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

  .message-tag {
    grid-column: 2;
    justify-self: start;
  }
}

.table-shell {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  padding-block: 1.35rem;
  border-radius: 1.25rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.025);
}

.table-shell-scroll {
  overflow: auto;
}

.mail-table {
  width: 100%;
  border-collapse: collapse;
}

.mail-table thead th {
  padding: 0;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sort-trigger {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.74);
  padding: 1rem 1rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-align: left;
  transition: color 0.15s ease, background 0.15s ease;
}

.sort-trigger:hover,
.sort-trigger.is-sorted {
  color: #fff;
  background: rgba(255, 255, 255, 0.03);
}

.sort-trigger:focus-visible {
  outline: 3px solid rgba(124, 196, 255, 0.35);
  outline-offset: -3px;
}

.sort-indicator {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.45);
  letter-spacing: 0;
}

.mail-table tbody tr {
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.mail-row {
  transition: background 0.15s ease, transform 0.15s ease;
}


.mail-row[data-href] {
  cursor: pointer;
}

.mail-row:hover {
  background: rgba(255, 255, 255, 0.035);
}

.mail-row:focus-visible {
  outline: 2px solid rgba(124, 196, 255, 0.35);
  outline-offset: -2px;
  background: rgba(255, 255, 255, 0.05);
}

.mail-row.unread .mail-subject-cell,
.mail-row.unread .mail-company-cell,
.mail-row.unread .mail-email-cell,
.mail-row.unread .mail-upload-type-cell {
  color: #fff;
  font-weight: 700;
}

.mail-row td {
  padding: 1rem;
  vertical-align: middle;
  color: rgba(255, 255, 255, 0.8);
}

.mail-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(124, 196, 255, 0.12);
}

.mail-dot.muted {
  background: rgba(255, 255, 255, 0.3);
  box-shadow: none;
}

.mail-subject-cell,
.mail-company-cell,
.mail-email-cell,
.mail-upload-type-cell,
.mail-confidence-cell,
.mail-received-cell,
.mail-status-cell {
  white-space: nowrap;
}

.mail-subject-cell {
  min-width: 0;
  white-space: normal;
  max-width: none;
  overflow: hidden;
  text-overflow: clip;
}

.mail-subject-cell,
.mail-company-cell {
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 0;
}

.mail-email-cell {
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 0;
  text-align: left;
  font-variant-numeric: tabular-nums;
}

.mail-upload-type-cell {
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 0;
}

.mail-title-link {
  color: inherit;
  text-decoration: none;
}

.mail-subject-title {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mail-received-cell {
  color: rgba(255, 255, 255, 0.62);
}

.mail-confidence-cell {
  color: rgba(255, 255, 255, 0.82);
  font-variant-numeric: tabular-nums;
}

.mail-status-cell {
  width: 1%;
}

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

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

.inbox-processing-modal-panel {
  position: relative;
  z-index: 1;
  width: min(40rem, calc(100vw - 2rem));
  max-height: min(80vh, 36rem);
  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;
}

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

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

.inbox-processing-modal-summary {
  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);
}

.inbox-processing-modal-label {
  color: rgba(255, 255, 255, 0.58);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.inbox-processing-modal-value {
  color: #fff;
  font-weight: 700;
}

.inbox-processing-modal-footer {
  display: flex;
  justify-content: flex-end;
}

.upload-subject-modal {
  position: fixed;
  inset: 0;
  z-index: 1145;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(4, 8, 16, 0.46);
  backdrop-filter: blur(4px);
}

.upload-subject-modal-backdrop {
  position: absolute;
  inset: 0;
}

.upload-subject-modal-panel {
  position: relative;
  z-index: 1;
  width: min(42rem, calc(100vw - 2rem));
  padding: 1.35rem;
  border-radius: 1.35rem;
  border: 1px solid rgba(124, 196, 255, 0.14);
  background: linear-gradient(180deg, rgba(10, 18, 34, 0.98) 0%, rgba(8, 14, 26, 0.96) 100%);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.42);
}

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

.upload-subject-modal-body {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

.upload-subject-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.upload-subject-input {
  width: 100%;
}

.upload-subject-error {
  margin-top: 0.75rem;
}

.inbox-drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 1140;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(4, 8, 16, 0.38);
  backdrop-filter: blur(2px);
}

.inbox-drop-overlay-panel {
  width: min(46rem, calc(100vw - 2rem));
  padding: 1.35rem;
  border-radius: 1.5rem;
  border: 1px dashed rgba(124, 196, 255, 0.24);
  background: rgba(8, 18, 34, 0.96);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.42);
  text-align: center;
}

.inbox-drop-message {
  margin-top: 1rem;
}

.inbox-drop-message.is-error {
  border-color: rgba(255, 113, 113, 0.2);
  background: rgba(255, 113, 113, 0.1);
  color: #ffd2d2;
}

@media (max-width: 992px) {
  .mail-table thead {
    display: none;
  }

  .mail-table,
  .mail-table tbody,
  .mail-table tr,
  .mail-table td {
    display: block;
    width: 100%;
  }

  .mail-row {
    padding: 0.5rem 0;
  }

  .mail-row td {
    padding: 0.55rem 1rem;
    white-space: normal;
  }

  .mail-subject-cell::before,
  .mail-company-cell::before,
  .mail-email-cell::before,
  .mail-upload-type-cell::before,
  .mail-confidence-cell::before,
  .mail-received-cell::before,
  .mail-status-cell::before {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.7rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.42);
  }

  .mail-subject-cell::before { content: 'Subject'; }
  .mail-company-cell::before { content: 'Sender'; }
  .mail-email-cell::before { content: 'Client name'; }
  .mail-upload-type-cell::before { content: 'Upload type'; }
  .mail-confidence-cell::before { content: 'Confidence'; }
  .mail-received-cell::before { content: 'Received'; }
  .mail-status-cell::before { content: 'Status'; }

  .mail-subject-cell,
  .mail-company-cell,
  .mail-email-cell,
  .mail-upload-type-cell,
  .mail-confidence-cell,
  .mail-received-cell,
  .mail-status-cell {
    display: block;
    max-width: none;
  }

  .inbox-processing-modal-panel {
    width: min(100vw - 1.5rem, 40rem);
  }

  .inbox-drop-overlay-panel {
    width: min(100vw - 1.5rem, 46rem);
  }
}
