:root {
  color-scheme: light;
  font-family: system-ui, sans-serif;
  background: #f5f7fa;
  color: #18202a;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
header {
  align-items: center;
  background: #16324f;
  color: white;
  display: flex;
  justify-content: space-between;
  min-height: 56px;
  padding: 0 20px;
}
header div { display: flex; gap: 6px; }
.home-link {
  align-content: center;
  background: #fff;
  border: 1px solid #bcc7d3;
  border-radius: 6px;
  color: #16324f;
  padding: 8px 12px;
  text-decoration: none;
}
button {
  background: #fff;
  border: 1px solid #bcc7d3;
  border-radius: 6px;
  cursor: pointer;
  padding: 8px 12px;
}
input, select, textarea { border: 1px solid #bcc7d3; border-radius: 6px; font: inherit; padding: 8px; width: 100%; }
textarea { resize: vertical; }
main { padding: 16px; }
#mail {
  background: white;
  border: 1px solid #d8e0e8;
  display: grid;
  grid-template-columns: minmax(190px, 1fr) minmax(260px, 1.5fr) minmax(320px, 3fr);
  height: calc(100vh - 88px);
}
#mail > * { padding: 16px; }
#mail > * + * { border-left: 1px solid #d8e0e8; }
h1 { font-size: 1rem; margin: 0 0 12px; }
h2 { font-size: .95rem; margin: 0; }
ul { list-style: none; margin: 0; padding: 0; }
li button { border: 0; text-align: left; width: 100%; }
li button:hover { background: #eef4fa; }
.mailbox-heading { align-items: center; display: flex; justify-content: space-between; }
.mailbox-heading div { display: flex; gap: 6px; }
.compact-form { border-bottom: 1px solid #d8e0e8; display: grid; gap: 8px; margin-bottom: 12px; padding-bottom: 12px; }
.compact-form div { align-items: center; display: flex; gap: 4px; }
.compact-form span { font-size: .8rem; white-space: nowrap; }
.primary-action { margin-bottom: 12px; width: 100%; }
#forwarding-row { align-items: center; display: flex; gap: 6px; margin-bottom: 10px; }
#forwarding-row input { width: auto; }
.compose { border: 1px solid #d8e0e8; border-radius: 6px; display: grid; gap: 7px; margin-bottom: 12px; padding: 10px; }
.compose p { font-size: .85rem; margin: 0; }
.messages { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
#mailbox-view, #compose-view { min-height: 0; overflow-y: auto; }
#mailbox-view { display: flex; flex-direction: column; }
#messages { min-height: 0; overflow-y: auto; }
#contact-list button { display: grid; gap: 2px; }
#contact-list small { color: #5d6b78; }
.message-item { align-items: center; display: grid; grid-template-columns: auto 1fr auto; }
.message-item .select { margin: 0 4px 0 6px; width: auto; }
.message-content { display: grid; gap: 4px; }
.message-content small { color: #5d6b78; }
.message-open { border: 0; text-align: left; width: 100%; }
.message-actions { display: flex; gap: 4px; }
.message-item .compact { font-size: .8rem; padding: 5px 7px; width: auto; }
.danger { border-color: #b42318; color: #b42318; }
pre { font: inherit; white-space: pre-wrap; word-break: break-word; }

@media (max-width: 850px) {
  #mail { display: block; height: auto; }
  #mail > * + * { border-left: 0; border-top: 1px solid #d8e0e8; }
  .messages { overflow: visible; }
  #messages { max-height: 55vh; }
}
.message-content .subject { font-weight: 400; }
.message-item.unread .subject { font-weight: 700; }
.message-item.unread .subject::before { background: #1d6fd6; border-radius: 50%; content: ""; display: inline-block; height: 8px; margin-right: 6px; width: 8px; }
.unread-badge { background: #1d6fd6; border-radius: 999px; color: #fff; font-size: .72rem; font-weight: 700; margin-left: 6px; padding: 1px 7px; }
#addresses button { align-items: center; display: flex; justify-content: space-between; }
.new-mail-notice { background: #e8f1fc; border-radius: 6px; color: #164d94; font-size: .85rem; margin: 0 0 8px; padding: 6px 8px; }
.bulk-bar { align-items: center; display: flex; gap: 10px; margin-bottom: 8px; }
.bulk-bar label { align-items: center; display: flex; font-size: .85rem; gap: 4px; }
.bulk-bar input { width: auto; }
.bulk-bar button { width: auto; }
.body-link { color: #1d6fd6; text-decoration: underline; word-break: break-all; }
.view-bar { display: flex; gap: 6px; margin: 8px 0; }
.view-bar button { width: auto; }
.view-bar button[aria-pressed="true"] { background: #e8f1fc; border-color: #1d6fd6; }
#html-body { background: #fff; border: 1px solid #d8e0e8; border-radius: 6px; flex: 1; min-height: 60vh; width: 100%; }
