/* Mail page: domains with their DNS records, mailboxes and forwards. Loaded after style.css, so it only adds to it. */

#mail-message { min-height: 1.3em; margin: .5rem 0 .75rem; }
#mail-message.ok { color: #4ade80; }
#mail-message.error { color: #f87171; }

select {
  padding: .55rem .6rem; font-size: 1rem; color: #e6edf3;
  background: #1a2129; border: 1px solid #2d3742; border-radius: 6px;
}
select:focus { outline: 2px solid #3b82f6; border-color: transparent; }

.mail-form { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: .75rem; }
.mail-form > input { flex: 1 1 14rem; }
.mail-form label { display: flex; align-items: center; gap: .4rem; color: #8b98a5; font-size: .9rem; }
.mail-address { display: flex; align-items: center; gap: .3rem; flex: 1 1 18rem; min-width: 0; max-width: 100%; }
.mail-address input { flex: 1 1 6rem; min-width: 0; width: 100%; }
.mail-address select { flex: 1 1 8rem; min-width: 0; width: 100%; }

/* the mail server strip: name, certificate, one chip per service, and the "mail apps" button */
.mail-server {
  display: flex; flex-wrap: wrap; align-items: center; gap: 14px; padding: 14px 16px;
  background: #1a2129; border: 1px solid #2d3742; border-radius: 10px; margin: 8px 0 0;
}
.mail-server-icon { display: inline-flex; color: #93c5fd; }
.mail-server-info { flex: 1 1 240px; min-width: 0; }
.mail-server-info strong { font-size: 1.05rem; }
.mail-cert { display: flex; align-items: center; gap: .3rem; font-size: .85rem; color: #8b98a5; margin-top: .2rem; }
.mail-cert.warn { color: #fbbf24; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: .85rem;
  background: #0f2a1a; color: #86efac; border: 1px solid #1f5131;
}
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: #4ade80; }
.chip.bad { background: #2a0f0f; color: #fca5a5; border-color: #7f1d1d; }
.chip.bad .dot { background: #f87171; }
.mail-apps { margin: 10px 0 0; padding: 4px 16px 12px; background: #161c23; border: 1px solid #2d3742; border-radius: 10px; }

/* mail domains: small cards, problems first; an open card spans the whole row */
.mail-domains { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; margin: 8px 0 20px; }
.mail-domain {
  background: #1a2129; border: 1px solid #2d3742; border-left: 3px solid #3a4654;
  border-radius: 8px; padding: 10px 12px 12px 14px; min-width: 0;
}
.mail-domain.ok { border-left-color: #22c55e; }
.mail-domain.bad { border-left-color: #ef4444; }
.mail-domain.open { grid-column: 1 / -1; }
.mail-domain-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.mail-domain-info { min-width: 0; }
.mail-domain-info strong { display: block; overflow-wrap: anywhere; }
.mail-domain-facts { display: block; font-size: .8rem; color: #8b98a5; margin-top: .1rem; }
.mail-domain .row-actions { flex-wrap: nowrap; }
.mail-domain table { margin-top: .75rem; }
.mail-domain .toolbar { margin: .25rem 0 0; }
.rec-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.rec-chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 6px; font-size: .75rem;
  font-weight: 600; letter-spacing: .02em; background: #222b35; color: #8b98a5;
}
.rec-chip.ok { background: #0f2a1a; color: #86efac; }
.rec-chip.bad { background: #2a0f0f; color: #fca5a5; }
button.icon-btn.spinning .icon { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { button.icon-btn.spinning .icon { animation: none; } }

/* mailboxes table: address, a bar for the space used, icon buttons */
.mail-tools label.search { flex: 1 1 18rem; }
table.mailboxes th.actions-head { text-align: right; }
.mailbox-cell strong { font-weight: 600; overflow-wrap: anywhere; }
.mailbox-since { display: block; font-size: .78rem; color: #8b98a5; margin-top: .1rem; }
.usage { min-width: 160px; }
.usage-bar { height: 8px; border-radius: 4px; background: #2d3742; overflow: hidden; }
.usage-fill { height: 8px; background: #3b82f6; }
.usage-bar.full .usage-fill { background: #f59e0b; }
.usage-text { font-size: .78rem; color: #8b98a5; margin-top: 4px; }
tr.problem .usage-text { color: #fbbf24; }

/* forwards: "address -> destination" rows */
.forwards { display: grid; gap: 8px; margin: 8px 0; }
.forward {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 10px 14px;
  background: #1a2129; border: 1px solid #2d3742; border-radius: 8px;
}
.forward-from { overflow-wrap: anywhere; }
.forward > svg { color: #8b98a5; flex: none; }
.forward-to { flex: 1 1 200px; color: #c9d1d9; overflow-wrap: anywhere; }

@media (max-width: 640px) {
  .mail-domains { grid-template-columns: 1fr; }
  .mail-server { gap: 10px 12px; }
  .mail-server-info { flex: 1 1 0; }
  .mail-server .chips { order: 3; flex-basis: 100%; }
  .usage { min-width: 0; flex: 1 1 auto; max-width: 14rem; margin-left: 1rem; }
  td.mailbox-cell { display: block; text-align: left; font-size: 1.05rem; }
  td.mailbox-cell::before { display: none; }
  .forward-to { flex-basis: 100%; }
}

.dns-value { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85rem; word-break: break-all; }
.dns-value.long { display: inline-block; max-width: 28rem; }
.dns-status.ok { color: #4ade80; }
.dns-status.bad { color: #fbbf24; }
.dns-status.unknown { color: #8b98a5; }
.dns-why { display: block; color: #8b98a5; font-size: .8rem; margin-top: .15rem; }

.size-edit { display: flex; gap: .3rem; align-items: center; }
.row-actions { display: flex; flex-wrap: wrap; gap: .3rem; justify-content: flex-end; }

/* New site row (Sites page): a known domain from the list, or "other domain..." */
#site-sub { flex: 1 1 8rem; }
#site-other { flex: 1 1 14rem; }
.site-dns { min-height: 1.3em; margin: -.25rem 0 .75rem; font-size: .9rem; }
.site-dns.ok { color: #4ade80; }
.site-dns.error { color: #f87171; }
.site-dns.warn { color: #fbbf24; }
