/* Armadillo admin UI: mobile-first, no inline styles (CSP style-src 'self'). */
:root {
  --bg: #fbfaf7;
  --fg: #1f2328;
  --muted: #5f6670;
  --line: #d8dbe0;
  --accent: #2f5d8a;
  --danger: #a3262b;
  --ok: #2c6e3f;
  --warn: #8a5a00;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16181c;
    --fg: #e8e6e3;
    --muted: #9aa1aa;
    --line: #2e333a;
    --accent: #7aa7d6;
    --danger: #f08b8f;
    --ok: #7cc493;
    --warn: #e3b25a;
  }
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.45;
}
a {
  color: var(--accent);
}
header.top {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: center;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--line);
}
header.top .brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  text-decoration: none;
  color: var(--fg);
}
header.top .brand img {
  display: block;
  height: 2.5rem;
  width: auto;
}
header.top nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}
header.top form {
  margin-left: auto;
}
main {
  max-width: 64rem;
  margin: 0 auto;
  padding: 1rem;
}
h1 {
  font-size: 1.4rem;
}
.muted {
  color: var(--muted);
}
.card {
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  padding: 1rem;
  margin: 1rem 0;
}
.narrow {
  max-width: 26rem;
  margin: 2rem auto;
}
label {
  display: block;
  margin: 0.75rem 0 0.25rem;
  font-weight: 600;
}
input,
select,
textarea {
  width: 100%;
  font: inherit;
  padding: 0.5rem;
  border: 1px solid var(--line);
  border-radius: 0.375rem;
  background: transparent;
  color: inherit;
}
button,
.button {
  display: inline-block;
  font: inherit;
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--accent);
  border-radius: 0.375rem;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  text-decoration: none;
}
button.secondary,
.button.secondary {
  background: transparent;
  color: var(--accent);
}
button.danger {
  border-color: var(--danger);
  background: var(--danger);
}
button.link {
  border: 0;
  background: none;
  color: var(--accent);
  padding: 0;
  text-decoration: underline;
}
.row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.flash {
  padding: 0.6rem 0.9rem;
  border-radius: 0.375rem;
  border: 1px solid var(--line);
  margin: 0.75rem 0;
}
.flash.error {
  border-color: var(--danger);
  color: var(--danger);
}
.flash.ok {
  border-color: var(--ok);
  color: var(--ok);
}
.badge {
  display: inline-block;
  font-size: 0.8rem;
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--line);
}
.badge.ok {
  color: var(--ok);
  border-color: var(--ok);
}
.badge.warn {
  color: var(--warn);
  border-color: var(--warn);
}
.badge.danger {
  color: var(--danger);
  border-color: var(--danger);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
th,
td {
  text-align: left;
  padding: 0.45rem 0.4rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
td.addr {
  font-family: ui-monospace, monospace;
  word-break: break-all;
}
.codes {
  font-family: ui-monospace, monospace;
  columns: 2;
}
.qr svg {
  width: 12rem;
  height: 12rem;
  background: #fff;
  padding: 0.5rem;
}
iframe.mail {
  width: 100%;
  min-height: 24rem;
  border: 1px solid var(--line);
  background: #fff;
}
pre.mail {
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px solid var(--line);
  padding: 0.75rem;
}
@media (max-width: 40rem) {
  table.responsive thead {
    display: none;
  }
  table.responsive tr {
    display: block;
    border-bottom: 1px solid var(--line);
    padding: 0.5rem 0;
  }
  table.responsive td {
    display: block;
    border: 0;
    padding: 0.15rem 0;
  }
}
/* Inbox (P2-02): two panes on desktop, list → message on phones. */
main.wide {
  max-width: 96rem;
}
.panes {
  display: block;
}
.panes .list,
.panes .reader {
  min-width: 0;
}
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.75rem;
}
.filters select,
.filters input[type="search"] {
  width: auto;
  flex: 1 1 10rem;
}
.filters label.inline {
  display: inline-flex;
  gap: 0.3rem;
  margin: 0;
  font-weight: 400;
}
.filters label.inline input {
  width: auto;
}
ul.messages {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}
ul.messages li a {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.1rem 0.5rem;
  padding: 0.55rem 0.5rem;
  border-bottom: 1px solid var(--line);
  color: inherit;
  text-decoration: none;
}
ul.messages li a:hover,
ul.messages li a:focus-visible {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}
ul.messages li.current a {
  background: color-mix(in srgb, var(--accent) 15%, transparent);
}
ul.messages li.unread .who,
ul.messages li.unread .subject {
  font-weight: 700;
}
ul.messages .who,
ul.messages .subject,
ul.messages .to {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
ul.messages .when,
ul.messages .to {
  color: var(--muted);
  font-size: 0.85rem;
}
ul.messages .subject {
  grid-column: 1 / -1;
}
.reader .back {
  margin-top: 0;
}
.reader .empty {
  padding: 2rem 0;
  text-align: center;
}
.reader h1 {
  margin-top: 0.25rem;
  overflow-wrap: anywhere;
}
.reader .meta p {
  margin: 0.2rem 0;
  overflow-wrap: anywhere;
}
/* Phones: the open message replaces the list (server class, or :has() after an htmx swap). */
@media (max-width: 55.99rem) {
  .panes.reading .list,
  .panes:has(.reader > article) .list {
    display: none;
  }
  .panes:not(.reading):not(:has(.reader > article)) .reader {
    display: none;
  }
}
@media (min-width: 56rem) {
  .panes {
    display: grid;
    grid-template-columns: minmax(18rem, 26rem) 1fr;
    gap: 1.25rem;
    align-items: start;
  }
  .panes .list {
    position: sticky;
    top: 0.5rem;
    max-height: calc(100vh - 7rem);
    overflow-y: auto;
  }
  .reader .back {
    display: none;
  }
}
/* ADR-0021: forms in a .row are plain flex items (no stray margins), and the sandboxed message
   frame starts dark in dark mode (its document inverts itself; see sanitize.ts VIEWER_THEME). */
form {
  margin: 0;
}
@media (prefers-color-scheme: dark) {
  iframe.mail {
    background: #16181c;
    border-color: var(--line);
  }
}
