/* Mail-specific styles, on top of the portal's app.css tokens.

   The portal's palette and shell are reused verbatim so this doesn't look like a different
   product once it's folded into rootedshores.net. Everything here is only the inbox. */

.wrap { max-width: 68rem; margin: 0 auto; padding: 1.25rem 1rem 3rem; }

/* ---- notices ---------------------------------------------------------------------------- */
.note {
  border-radius: var(--r-s); padding: .6rem .85rem; margin: 0 0 1rem;
  border: 1px solid var(--line); background: var(--card-2); font-size: .94rem;
}
.note.warn  { border-color: var(--sun);  background: var(--sun-soft); }
.note.error { border-color: var(--clay); background: var(--clay-soft); }

/* ---- thread list ------------------------------------------------------------------------ */
.threads { display: flex; flex-direction: column; gap: 1px; background: var(--line-2);
           border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.thread-row {
  display: grid; grid-template-columns: 12rem 1fr 5.5rem; gap: .9rem; align-items: baseline;
  padding: .7rem .9rem; background: var(--card); color: inherit; text-decoration: none;
}
.thread-row:hover { background: var(--card-2); text-decoration: none; }
.thread-row .who { font-weight: 600; overflow: hidden; text-overflow: ellipsis;
                   white-space: nowrap; }
.thread-row .subject { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-row .preview { color: var(--muted); font-weight: 400; }
.thread-row .when { color: var(--faint); font-size: .85rem; text-align: right;
                    white-space: nowrap; }
.thread-row.unread .who,
.thread-row.unread .subject { font-weight: 700; }
.thread-row.unread { border-left: 3px solid var(--sprout); }
.thread-row .count { color: var(--faint); font-size: .8rem; }
.pill { display: inline-block; font-size: .72rem; padding: .05rem .4rem; border-radius: 999px;
        background: var(--water-soft); color: var(--water); vertical-align: middle; }

/* ---- one conversation ------------------------------------------------------------------- */
.msg { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card);
       margin: 0 0 .85rem; overflow: hidden; }
.msg.mine { background: var(--sprout-soft); border-color: var(--sprout); }
.msg > header { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
                padding: .6rem .9rem; border-bottom: 1px solid var(--line-2);
                font-size: .9rem; }
.msg > header .from { font-weight: 600; }
.msg > header .when { color: var(--faint); }
.msg .body { padding: .9rem; overflow-wrap: anywhere; }
/* Mail HTML is arbitrary and hostile to layout — keep it inside its own box. */
.msg .body img { max-width: 100%; height: auto; }
.msg .body table { max-width: 100%; display: block; overflow-x: auto; }
.msg .body pre { white-space: pre-wrap; }
.msg .files { padding: .5rem .9rem; border-top: 1px solid var(--line-2); font-size: .9rem; }
.msg .files a { margin-right: .8rem; }

/* ---- reply ------------------------------------------------------------------------------ */
.replybox { border: 1px solid var(--line); border-radius: var(--radius);
            background: var(--card); padding: .9rem; }
.replybox textarea { width: 100%; min-height: 9rem; font: inherit; padding: .6rem;
                     border: 1px solid var(--line); border-radius: var(--r-s);
                     background: var(--card-2); color: inherit; resize: vertical; }
.rowbtns { display: flex; gap: .5rem; align-items: center; margin-top: .6rem; flex-wrap: wrap; }
.rowbtns .spacer { flex: 1; }

/* ---- search + bulk ---------------------------------------------------------------------- */
.searchbar { display: flex; gap: .5rem; margin: 0 0 1rem; }
.searchbar input { flex: 1; font: inherit; padding: .55rem .7rem; border: 1px solid var(--line);
                   border-radius: var(--r-s); background: var(--card); color: inherit; }
.field { display: block; margin: 0 0 .9rem; }
.field > span { display: block; font-size: .85rem; color: var(--muted); margin-bottom: .25rem; }
.field input, .field textarea {
  width: 100%; font: inherit; padding: .55rem .7rem; border: 1px solid var(--line);
  border-radius: var(--r-s); background: var(--card); color: inherit;
}
.field textarea { min-height: 8rem; resize: vertical; }
.mono { font-family: var(--mono); font-size: .88rem; }
table.grid { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.grid th, table.grid td { text-align: left; padding: .4rem .6rem;
                               border-bottom: 1px solid var(--line-2); }
.status-sent { color: var(--sprout); }
.status-failed { color: var(--clay); }
.status-suppressed, .status-pending { color: var(--muted); }

.foot { text-align: center; color: var(--faint); font-size: .85rem; padding: 0 1rem 2rem; }
.empty { color: var(--muted); padding: 2rem; text-align: center; }

@media (max-width: 40rem) {
  .thread-row { grid-template-columns: 1fr 4.5rem; }
  .thread-row .who { grid-column: 1; }
  .thread-row .when { grid-column: 2; grid-row: 1; }
  .thread-row .subject { grid-column: 1 / -1; }
}

/* Two fields side by side in the composer — collapses on a phone. */
.two { display: flex; gap: 1rem; flex-wrap: wrap; }
.two > .field { flex: 1 1 18rem; }

/* ---- connect ---------------------------------------------------------------------------- */
.note.ok-note { border-color: var(--sprout); background: var(--sprout-soft); }
.codebox { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card);
           padding: 1.2rem 1.3rem; max-width: 34rem; }
.codebox .code {
  font-family: var(--mono); font-size: 2rem; font-weight: 700; letter-spacing: .16em;
  background: var(--card-2); border: 1px solid var(--line); border-radius: var(--r-s);
  padding: .7rem 1rem; margin: .3rem 0 1.1rem; text-align: center; user-select: all;
}
h2.sec { font-size: 1rem; margin: 1.6rem 0 .7rem; padding-bottom: .3rem;
         border-bottom: 1px solid var(--line-2); color: var(--muted);
         font-weight: 600; letter-spacing: .02em; }

/* A message shows what the person wrote; the quoted ancestry folds away behind a summary. */
.msg .written { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg details.quoted { margin-top: .8rem; border-top: 1px solid var(--line-2); padding-top: .6rem; }
.msg details.quoted > summary { cursor: pointer; color: var(--muted); font-size: .85rem;
                                list-style: none; }
.msg details.quoted > summary::before { content: "⌄ "; }
.msg details.quoted[open] > summary::before { content: "⌃ "; }
.msg details.quoted > summary:hover { color: var(--ink); }
