/* Kept in a file rather than a <style> block: the CSP allows style-src 'self'
   only, with no unsafe-inline (SECURITY.md 3.4). */
:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --ink: #14161a;
  --muted: #5b6472;
  --line: #dde1e7;
  --accent: #1d4ed8;
  --error: #b91c1c;
  --ok: #15803d;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: .75rem 1.25rem;
  background: var(--card); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; text-decoration: none; color: var(--ink); }
.topbar nav { display: flex; align-items: center; gap: 1rem; }
.topbar nav form { margin: 0; }
.who { color: var(--muted); font-size: .9rem; }
main { max-width: 78rem; margin: 2rem auto; padding: 0 1.25rem; }

/* The list screens earn the whole monitor: a mailbox row is a line of
   scannable columns, not prose, and cramming it into a reading column
   wastes half the screen. Pages that are mostly text keep a readable
   measure — a 2000px-wide paragraph is harder to read, not easier. */
main:has(.card.wide) { max-width: 118rem; }
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 1.5rem;
}
.card.narrow { max-width: 26rem; margin: 0 auto; }
h1 { margin-top: 0; font-size: 1.35rem; }
label { display: block; margin: 1rem 0 .25rem; font-weight: 600; font-size: .9rem; }
.hint { font-weight: 400; color: var(--muted); }
input[type=email], input[type=password], input[type=text] {
  width: 100%; padding: .6rem .7rem; font-size: 1rem;
  border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink);
}
button {
  margin-top: 1.25rem; padding: .6rem 1.1rem; font-size: 1rem; font-weight: 600;
  color: #fff; background: var(--accent); border: 0; border-radius: 8px; cursor: pointer;
}
button.linkish {
  margin: 0; padding: 0; background: none; color: var(--accent);
  font-weight: 500; font-size: .9rem; text-decoration: underline;
}
.note { color: var(--muted); font-size: .92rem; }
.error { color: var(--error); font-weight: 600; }
.ok { color: var(--ok); font-weight: 600; }
table { width: 100%; border-collapse: collapse; margin-top: 1.5rem; font-size: .93rem; }
th, td { text-align: left; padding: .5rem .4rem; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; }
code { background: var(--bg); padding: .1rem .35rem; border-radius: 4px; }
form.inline { display: grid; gap: .2rem; max-width: 26rem; }

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a; --card: #1c1f26; --ink: #e8eaed; --muted: #9aa3b2;
    --line: #2c313a; --accent: #7aa2ff; --error: #f87171; --ok: #4ade80;
  }
  input[type=email], input[type=password], input[type=text] { background: #12151a; }
  button { color: #12151a; }
}

/* ── Postaláda ───────────────────────────────────────────────────────── */
.card.wide { max-width: none; }
/* Inside a wide card, prose still gets a measure. */
.verdict, .meta, .note, .hint, .risk, .warn { max-width: 62rem; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.tabs { display: flex; flex-wrap: wrap; gap: .25rem; border-bottom: 1px solid var(--line);
        margin: -.5rem -.5rem 1rem; padding: 0 .5rem; }
.tab { padding: .5rem .8rem; text-decoration: none; color: var(--muted);
       border-bottom: 2px solid transparent; font-weight: 600; font-size: .93rem; }
.tab-active { color: var(--ink); border-bottom-color: var(--accent); }
.tab-count { color: var(--muted); font-weight: 400; font-size: .85rem; }

.filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: 1rem; }
.filters input[type=search], .filters select {
  padding: .45rem .6rem; border: 1px solid var(--line); border-radius: 8px;
  background: var(--card); color: var(--ink); font-size: .93rem; }
.filters input[type=search] { flex: 1 1 14rem; min-width: 0; }
.filters button { margin: 0; padding: .45rem .9rem; font-size: .93rem; }
.clear { color: var(--muted); font-size: .87rem; }

.msglist { list-style: none; margin: 0; padding: 0; }
.msg { border-bottom: 1px solid var(--line); }
.msg-link { display: flex; gap: .75rem; padding: .7rem .2rem; text-decoration: none;
            color: var(--ink); align-items: flex-start; }
.msg-link:hover { background: var(--bg); }
.msg-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .15rem; }
.msg-top { display: flex; justify-content: space-between; gap: .5rem; }
.from { font-size: .93rem; }
.when { color: var(--muted); font-size: .82rem; white-space: nowrap; }
.subject { font-size: .95rem; }
.snippet { color: var(--muted); font-size: .87rem; overflow: hidden;
           text-overflow: ellipsis; white-space: nowrap; }

/* On a wide screen the sender, subject and snippet sit side by side
   instead of stacking, so one row is one line and more of the mailbox
   fits on screen. */
@media (min-width: 68rem) {
  .msg-main { display: grid; grid-template-columns: 15rem minmax(0, 1fr) auto;
              align-items: baseline; gap: .1rem 1rem; }
  .msg-top { display: contents; }
  .from { grid-column: 1; }
  .when { grid-column: 3; grid-row: 1; }
  .subject { grid-column: 2; grid-row: 1; font-weight: 600; }
  .snippet { grid-column: 2 / 4; grid-row: 2; }
  .badges { grid-column: 1 / 4; grid-row: 3; }
}

.imp { display: inline-flex; align-items: center; justify-content: center;
       min-width: 1.7rem; height: 1.7rem; border-radius: 6px; font-weight: 700;
       font-size: .87rem; color: #fff; background: var(--muted); flex: none; }
.imp-5 { background: #b91c1c; }
.imp-4 { background: #ea580c; }
.imp-3 { background: #2563eb; }
.imp-2 { background: #64748b; }
.imp-1 { background: #94a3b8; }
.imp-0 { background: var(--line); color: var(--muted); }

.badges { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .15rem; }
.badge { font-size: .75rem; padding: .1rem .4rem; border-radius: 4px;
         background: var(--bg); border: 1px solid var(--line); color: var(--muted); }
.badge-draft { border-color: var(--ok); color: var(--ok); }
.badge-warn { border-color: var(--error); color: var(--error); }
.badge-never { border-color: var(--ink); color: var(--ink); }
.badge-manual { border-color: var(--accent); color: var(--accent); }

.pager { display: flex; justify-content: space-between; align-items: center;
         gap: 1rem; padding-top: 1rem; font-size: .9rem; color: var(--muted); }

/* ── Levélnézet ──────────────────────────────────────────────────────── */
.back { margin: 0 0 .75rem; font-size: .9rem; }
.meta { color: var(--muted); font-size: .93rem; margin-top: -.5rem; }
.verdict { background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
           padding: .75rem 1rem; margin: 1rem 0; }
.verdict p { margin: .35rem 0; }
.warn { color: var(--error); font-weight: 600; }
.inline-form { margin-top: .5rem; }
.inline-form button { margin-top: .4rem; padding: .4rem .8rem; font-size: .9rem; }
h2 { font-size: 1.05rem; margin-top: 1.75rem; }
iframe.body { width: 100%; min-height: 24rem; border: 1px solid var(--line);
              border-radius: 8px; background: #fff; }
.attachments { padding-left: 1.2rem; font-size: .93rem; }

.labels { display: flex; flex-wrap: wrap; gap: .4rem; }
.labelform { display: inline-flex; gap: .2rem; margin: 0; }
.chip { margin: 0; padding: .3rem .6rem; font-size: .85rem; font-weight: 500;
        background: var(--card); color: var(--ink); border: 1px solid var(--line);
        border-radius: 999px; }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip-on { background: var(--accent); color: #fff; border-color: var(--accent); }
.chip-sender { color: var(--muted); border-style: dashed; }

@media (max-width: 40rem) {
  main { margin: 1rem auto; }
  .card { padding: 1rem; border-radius: 0; border-left: 0; border-right: 0; }
  .filters input[type=search] { flex-basis: 100%; }
  .snippet { display: none; }
  iframe.body { min-height: 18rem; }
}

/* ── Válaszok ────────────────────────────────────────────────────────── */
.undo-box { background: var(--bg); border: 1px solid var(--ok); border-radius: 8px;
            padding: .75rem 1rem; margin-bottom: 1.25rem; }
.undo-list { list-style: none; margin: .5rem 0 0; padding: 0; }
.undo-list li { display: flex; justify-content: space-between; align-items: center;
                gap: 1rem; padding: .25rem 0; font-size: .93rem; }
.undo-list form { margin: 0; }

.bulkbar { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem;
           padding: .75rem 0; }
.bulkbar button { margin: 0; }
.drafts { list-style: none; margin: 0; padding: 0; }
.draft { border: 1px solid var(--line); border-radius: 8px; padding: .75rem;
         margin-bottom: .5rem; }
.draft-focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(29,78,216,.15); }
.draft-risky { border-color: var(--error); }
.draft-head { display: flex; align-items: center; gap: .6rem; }
.draft-who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.riskmark { display: inline-flex; align-items: center; justify-content: center;
            width: 1.2rem; height: 1.2rem; border-radius: 50%; background: var(--error);
            color: #fff; font-weight: 700; font-size: .8rem; flex: none; }
.risk { color: var(--error); font-size: .9rem; margin: .5rem 0 0; }
.original { background: var(--bg); padding: .75rem; border-radius: 6px;
            white-space: pre-wrap; font: inherit; font-size: .88rem; max-height: 18rem;
            overflow: auto; }
.card.single { margin-top: 1rem; }
textarea { width: 100%; padding: .6rem .7rem; font: inherit; border: 1px solid var(--line);
           border-radius: 8px; background: var(--card); color: var(--ink); resize: vertical; }
.draft-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center;
                 margin-top: .75rem; }
.draft-actions form { display: flex; gap: .35rem; margin: 0; align-items: center; }
.draft-actions.secondary input[type=text] { padding: .3rem .5rem; font-size: .85rem;
           border: 1px solid var(--line); border-radius: 6px; background: var(--card);
           color: var(--ink); }
a.chip { text-decoration: none; display: inline-flex; align-items: center; }

.replybox { border: 1px solid var(--line); border-radius: 8px; padding: 1rem;
            background: var(--card); }
.replybox.draft-risky { border-color: var(--error); }
.replybox form { margin: 0; }
.replybox .inline-form { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.replybox .inline-form input[type=text] { flex: 1 1 18rem; padding: .45rem .6rem;
            border: 1px solid var(--line); border-radius: 8px; background: var(--card);
            color: var(--ink); }
.replybox .inline-form button { margin: 0; }
kbd { font: inherit; font-size: .85em; padding: .05rem .3rem; border: 1px solid var(--line);
      border-radius: 4px; background: var(--bg); }
