/* Mail owns its three-pane workspace; controls and colors come from shared Basecoat. */
.heading, .section-title { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.heading { margin-bottom: 1.5rem; }
.heading p:last-child { margin-bottom: 0; }
.section-title h2 { margin-bottom: 0; }
main > [data-workspace-panel], .mail-reference-detail { background: var(--card); border: 1px solid var(--border); border-radius: .7rem; padding: 1.3rem; }
main > [data-workspace-panel]:not(.mail-workspace) > .section-title { margin-bottom: 1rem; }
label { display: grid; gap: .35rem; margin: .7rem 0; }
label input, label select, label textarea { width: 100%; }
label.check { display: flex; align-items: center; gap: .5rem; }
label.check input { width: auto; }
body > footer { padding: 1rem; text-align: center; color: var(--muted-foreground); font-size: .7rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.mail-workspace {
  display: grid;
  grid-template-columns: 190px minmax(260px, 0.85fr) minmax(300px, 1.35fr);
  padding: 0;
  overflow: hidden;
  min-height: 570px;
}
main > .mail-workspace { padding: 0; }
.mail-folders, .mail-list-pane, .mail-reading-pane { min-width: 0; }
.mail-folders {
  padding: 1rem;
  background: var(--muted);
  border-right: 1px solid var(--border);
}
.mail-folders h2, .mail-list-heading h2 { font-size: .95rem; }
.mail-folders label { font-size: .8rem; }
.mail-folder-list { display: grid; gap: .25rem; margin: 1.2rem -.4rem; }
.mail-folder-list button {
  justify-content: start;
  width: 100%;
  text-align: left;
  border-color: transparent;
  background: transparent;
  font-weight: 400;
  white-space: normal;
  overflow-wrap: anywhere;
}
.mail-folder-list button[aria-current="true"] {
  background: var(--card);
  border-color: var(--border);
  color: var(--foreground);
  font-weight: 600;
}
.mail-manage { width: 100%; }
.mail-folder-help { margin-top: 1rem; font-size: .75rem; }
.mail-list-pane { border-right: 1px solid var(--border); }
.mail-list-heading { padding: 1rem 1rem .4rem; }
.mail-search { padding: .4rem 1rem; }
.mail-query { display: flex; gap: .4rem; align-items: center; }
.mail-query input { min-width: 0; flex: 1; }
.mail-filter-details { margin-top: .6rem; font-size: .8rem; }
.mail-filters { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem .7rem; }
.mail-filters label:last-child { grid-column: 1 / -1; }
.mail-filters label { font-size: .8rem; }
#list-status { padding: .2rem 1rem .7rem; margin: 0; font-size: .75rem; }
.messages { list-style: none; margin: 0; padding: 0; }
.messages li { position: relative; padding: 1rem; border-top: 1px solid var(--border); }
.messages li > span, .messages li > small { display: block; margin-top: .35rem; overflow-wrap: anywhere; }
.messages li > span { color: var(--muted-foreground); font-size: .78rem; }
.messages li > small { color: var(--muted-foreground); font-size: .72rem; }
.mail-row-meta { display: flex; justify-content: space-between; gap: .7rem; margin-top: .55rem; color: var(--muted-foreground); font-size: .75rem; }
.mail-row-sender { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-row-time { flex: 0 0 auto; white-space: nowrap; font-variant-numeric: tabular-nums; }
.messages li > button {
  display: block;
  border: 0;
  padding: 0;
  height: auto;
  background: transparent;
  color: var(--foreground);
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
  font-weight: 500;
  line-height: 1.5;
}
.messages li[data-unread="true"] > button { font-weight: 700; }
.messages li[data-unread="true"]::before {
  content: "";
  position: absolute;
  top: 1.4rem;
  left: .3rem;
  height: .32rem;
  width: .32rem;
  border-radius: 50%;
  background: var(--primary);
}
.messages li[data-selected="true"] { background: var(--muted); box-shadow: inset 3px 0 var(--primary); }
.messages li:hover { background: var(--muted); }
#messages { max-height: 65dvh; overflow-y: auto; }
#more-messages { margin: .8rem 1rem; }
.mail-reading-pane { overflow-wrap: anywhere; }
.mail-reading-empty { display: grid; align-content: center; justify-items: center; min-height: 480px; padding: 2rem; text-align: center; color: var(--muted-foreground); }
.mail-reading-empty h2 { color: var(--foreground); font-size: 1rem; margin-bottom: .25rem; }
.mail-reading-empty p { font-size: .85rem; }
.mail-empty-icon { font-size: 2rem; margin-bottom: 1rem; }
#message-detail { padding: 1.4rem; border: 0; border-radius: 0; margin: 0; background: transparent; }
#message-subject { font-size: 1.2rem; line-height: 1.6; overflow-wrap: anywhere; }
#message-addresses { font-size: .8rem; color: var(--muted-foreground); margin: .8rem 0 1.1rem; }
.mail-message-actions { margin: 1rem 0; }
.mail-message-actions button { font-size: .8rem; }
.mail-message-more, .mail-originals { font-size: .8rem; border-top: 1px solid var(--border); padding: .8rem 0; }
.body-text { min-height: 180px; padding: 1rem 0; margin: 0 0 1rem; max-height: 55dvh; overflow-y: auto; line-height: 1.85; font-size: .9rem; }
.mail-reading-modes { align-items: center; }
.mail-reading-modes button[aria-pressed="true"] { font-weight: 700; }
#preview-status:empty { display: none; }
#message-html iframe { display: block; width: 100%; height: min(64dvh, 46rem); min-height: 18rem; margin: .75rem 0 1rem; border: 1px solid var(--border); border-radius: .5rem; background: #fff; }
.mail-text-links { margin: 0 0 1rem; overflow-wrap: anywhere; }
.mail-reading-pane pre, #mail-reference-detail pre { white-space: pre-wrap; overflow-wrap: anywhere; font-family: inherit; }
#message-detail > h3 { margin-top: 1rem; font-size: .85rem; }
.accounts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 1rem; }
.accounts article, #operations article { border: 1px solid var(--border); border-radius: .65rem; padding: 1rem; margin: .8rem 0; }
.accounts article > button { font-weight: 600; }
.accounts article p { font-size: .85rem; }
#operations article p { margin: .55rem 0; }
#operations article[data-attention="true"] { border-left: 3px solid var(--destructive); }
.mail-operation-alert { display: flex; align-items: center; justify-content: space-between; gap: .8rem; margin: 0 0 1rem; padding: .7rem 1rem; border: 1px solid var(--border); border-left: 3px solid var(--destructive); border-radius: .5rem; font-size: .85rem; background: var(--card); }
.mail-mobile { display: none; }
#attachments { padding-left: 1.25rem; }
#attachments li { margin: .7rem 0; overflow-wrap: anywhere; }
#attachments button, #attachments a { margin: .3rem .5rem; }
.mail-reference-detail { margin-bottom: 1rem; }
#conflict-detail table { width: 100%; table-layout: fixed; border-collapse: collapse; font-size: .8rem; }
#conflict-detail td, #conflict-detail th { border: 1px solid var(--border); padding: .7rem; text-align: left; vertical-align: top; overflow-wrap: anywhere; }
#conflict-detail th { background: var(--muted); }
#conflict-detail pre { white-space: pre-wrap; font: inherit; max-height: 35rem; overflow: auto; }
@media (max-width: 1150px) {
  .mail-workspace { grid-template-columns: 155px minmax(230px, .85fr) minmax(260px, 1fr); }
  .mail-folders { padding: .8rem; }
  #message-detail { padding: 1rem; }
}
@media (max-width: 980px) {
  .mail-workspace { display: block; min-height: 480px; }
  .mail-mobile { display: inline-flex; }
  .mail-folders, .mail-list-pane { border-right: 0; }
  .mail-workspace[data-mail-pane="list"] .mail-folders,
  .mail-workspace[data-mail-pane="list"] .mail-reading-pane,
  .mail-workspace[data-mail-pane="folders"] .mail-list-pane,
  .mail-workspace[data-mail-pane="folders"] .mail-reading-pane,
  .mail-workspace[data-mail-pane="reading"] .mail-folders,
  .mail-workspace[data-mail-pane="reading"] .mail-list-pane { display: none; }
  .mail-folders { min-height: 480px; }
  .mail-folder-list { margin: 1rem 0; }
  #messages { max-height: none; }
  #mail-back-to-list { margin-bottom: 1rem; }
  .body-text { max-height: none; }
  .mail-operation-alert { align-items: start; flex-wrap: wrap; }
}
@media (max-width: 500px) {
  #conflict-detail table, #conflict-detail tbody, #conflict-detail tr, #conflict-detail td { display: block; }
  #conflict-detail thead { display: none; }
  #conflict-detail td::before { content: attr(data-label); display: block; font-weight: 700; margin-bottom: .5rem; }
}
