body {
  background: #f7f7f8;
}

.login-panel {
  max-width: 360px;
  margin-top: 12vh;
  padding: 24px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
}

.mail-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 16px;
  height: calc(100vh - 92px);
  font-size: 0.875rem;
}

.account-sidebar,
.message-list,
.detail-panel,
.message-detail-page {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
}

.account-sidebar {
  padding: 8px;
  align-self: start;
}

.account-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 32px;
  align-items: center;
  gap: 4px;
  border-radius: 6px;
}

.account-link {
  display: block;
  min-width: 0;
  padding: 10px;
  border-radius: 6px;
  color: #1f2937;
  text-decoration: none;
}

.account-item.active,
.account-item:hover,
.account-link.active,
.account-link:hover {
  background: #eef2ff;
}

.account-link small {
  display: block;
  color: #6b7280;
  overflow-wrap: anywhere;
}

.account-sync-form {
  margin: 0;
}

.sync-button {
  width: 28px;
  height: 28px;
  border: 1px solid #d1d5db;
  border-radius: 999px;
  background: #fff;
  color: #4b5563;
  line-height: 1;
}

.sync-button:hover,
.sync-button:focus {
  border-color: #818cf8;
  color: #3730a3;
  outline: none;
}

.message-alerts {
  max-width: 960px;
  margin: 0 auto 12px;
}

.mail-main {
  display: grid;
  grid-template-rows: minmax(220px, 42vh) minmax(280px, 1fr);
  gap: 16px;
  min-width: 0;
  min-height: 0;
}

.message-list {
  min-height: 0;
  overflow: hidden;
}

.list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid #e5e7eb;
}

.message-table {
  max-height: calc(42vh - 56px);
  overflow: auto;
}

.message-row {
  display: grid;
  grid-template-columns: minmax(140px, 220px) minmax(0, 1fr) 150px;
  gap: 12px;
  padding: 9px 14px;
  color: #111827;
  text-decoration: none;
  border-bottom: 1px solid #f0f1f3;
}

.message-row:hover,
.message-row:focus {
  background: #f9fafb;
  outline: none;
}

.message-row.unread {
  font-weight: 700;
}

.message-row.unread .message-meta {
  color: #374151;
}

.message-from,
.message-subject,
.message-meta {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-meta {
  color: #6b7280;
  text-align: right;
}

.detail-panel {
  min-height: 0;
  overflow: auto;
}

.detail-placeholder {
  display: grid;
  place-content: center;
  min-height: 280px;
  padding: 24px;
  color: #6b7280;
  text-align: center;
}

.detail-placeholder h2 {
  color: #374151;
  font-size: 1.15rem;
}

.pagination-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  padding: 16px;
}

.empty-state {
  padding: 48px 16px;
  color: #6b7280;
  text-align: center;
}

.message-detail-page {
  max-width: 960px;
  margin: 0 auto;
  padding: 20px;
}

.message-detail {
  padding: 16px;
  font-size: 0.875rem;
}

.message-header h1 {
  font-size: 1.15rem;
}

.message-header dl {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 4px 12px;
  color: #374151;
}

.message-header dd {
  min-width: 0;
  overflow-wrap: anywhere;
}

.message-body {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid #e5e7eb;
  overflow-wrap: anywhere;
}

.text-body {
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

@media (max-width: 800px) {
  .mail-layout {
    grid-template-columns: 1fr;
    height: auto;
  }

  .mail-main {
    grid-template-rows: auto auto;
  }

  .message-table {
    max-height: none;
  }

  .message-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .message-meta {
    text-align: left;
  }
}
