:root {
  --bg: #f4f6f9; --surface: #fff; --text: #1a1d23; --muted: #5d6573; --line: #dfe3ea; --hover: #eef3fb;
  --accent: #1d4e89; --accent-ink: #fff; --accent-soft: #e3ecf8;
  --good: #1e7b45; --good-bg: #e6f4ec; --bad: #b3261e; --bad-bg: #fbe9e7; --warn: #8a5a00; --warn-bg: #fff4dc;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); display: flex; flex-direction: column;
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); }
code { font-family: var(--mono); font-size: .86em; background: #eef1f5; padding: 0 .3em; border-radius: 3px;
  overflow-wrap: anywhere; }
h1 { font-size: 1.45rem; margin: .1rem 0 .7rem; overflow-wrap: anywhere; }
h2 { font-size: 1.05rem; margin: 0 0 .6rem; }

.top { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem;
  padding: .6rem 1.2rem; background: var(--accent); color: var(--accent-ink); }
.top a, .top button.link { color: var(--accent-ink); }
.brand { font-weight: 700; text-decoration: none; font-size: 1.05rem; }
.top nav { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; font-size: .92rem; }
.top nav a { text-decoration: none; opacity: .92; } .top nav a:hover { opacity: 1; text-decoration: underline; }
.who { opacity: .8; }

.page { max-width: 1000px; width: 100%; margin: 1.5rem auto; padding: 0 1rem; }
.mail { flex: 1 0 auto; display: grid; grid-template-columns: 210px 1fr; }
.folders { background: var(--surface); border-right: 1px solid var(--line); padding: .8rem .5rem; }
.folders ul { list-style: none; margin: 0; padding: 0; }
.folders a { display: flex; justify-content: space-between; padding: .45rem .75rem; border-radius: 6px;
  text-decoration: none; color: var(--text); }
.folders a:hover { background: var(--hover); }
.folders a.active { background: var(--accent-soft); font-weight: 600; color: var(--accent); }
.count { font-weight: 700; color: var(--accent); }
.folders li.d1 a { padding-left: 1.6rem; } .folders li.d2 a { padding-left: 2.45rem; }
.folders li.d3 a { padding-left: 3.3rem; } .folders li[class^="d"]:not(.d0):not(.d1):not(.d2):not(.d3) a { padding-left: 4.15rem; }
.folders li a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.manage { display: block; margin: .4rem .75rem 0; font-size: .85rem; color: var(--muted); }
a.manage:hover { color: var(--text); }
.folder-list { list-style: none; margin: 0; padding: 0; }
.rule-list { list-style: none; margin: 0; padding: 0; }
.rule-list > li { border-top: 1px solid var(--line); padding: .7rem 0; display: grid; gap: .25rem; }
.rule-list > li:first-child { border-top: 0; }
.rule-list > li.off > :not(.rule-tools):not(details) { opacity: .65; }
.rule-list .muted { overflow-wrap: anywhere; }
.rule-head { display: flex; gap: .5rem; align-items: baseline; flex-wrap: wrap; }
.rule-tools { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .2rem; }
.rule-list summary { cursor: pointer; color: var(--accent); font-size: .9rem; }
.rule-list details form { margin-top: .6rem; }
.folder-list > li { border-top: 1px solid var(--line); padding: .6rem 0; }
.folder-list > li:first-child { border-top: 0; }
.folder-list .path { font-weight: 600; overflow-wrap: anywhere; }
.folder-list details { margin-top: .3rem; }
.folder-list summary { cursor: pointer; color: var(--accent); font-size: .9rem; }
form.inline.move select { display: inline-block; width: auto; max-width: 12rem; margin: 0 .2rem 0 0; padding: .3rem .5rem;
  font-size: .9rem; }
.pane { padding: 1rem 1.4rem 2rem; min-width: 0; }
.pane-head { display: flex; align-items: baseline; justify-content: space-between; }

.msglist { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line);
  border-radius: 8px; overflow: hidden; }
.msglist li + li { border-top: 1px solid var(--line); }
.msglist a { display: grid; grid-template-columns: 1fr auto; gap: 0 1rem; padding: .6rem 1rem;
  text-decoration: none; color: var(--text); }
.msglist a:hover { background: var(--hover); }
.msglist .from { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msglist .date { color: var(--muted); font-size: .85rem; white-space: nowrap; }
.msglist .subject, .msglist .snippet { grid-column: 1 / -1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msglist .snippet { color: var(--muted); font-size: .88rem; }
.msglist .unread { border-left: 3px solid var(--accent); }
.msglist .unread .from, .msglist .unread .subject { font-weight: 700; }
.flag { color: var(--bad); }
.pager { display: flex; gap: 1rem; margin-top: .8rem; }
.empty { padding: 3rem 1rem; text-align: center; color: var(--muted); background: var(--surface);
  border: 1px dashed var(--line); border-radius: 8px; }
.note { background: var(--accent-soft); border-radius: 6px; padding: .6rem .9rem; font-size: .92rem; }

.toolbar { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.tool { display: inline-block; background: var(--surface); color: var(--text); border: 1px solid var(--line);
  border-radius: 6px; padding: .35rem .8rem; font: inherit; font-size: .9rem; cursor: pointer; text-decoration: none; }
.tool:hover { background: var(--hover); }
.tool.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.message { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 1.1rem 1.3rem; }
.message .subject { font-size: 1.35rem; }
.meta { margin-bottom: .8rem; font-size: .92rem; }
.badge { display: inline-block; border-radius: 999px; padding: .05rem .6rem; font-size: .78rem; font-weight: 600;
  background: #eef1f5; color: var(--muted); vertical-align: middle; }
.badge.good { background: var(--good-bg); color: var(--good); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.why { border: 1px solid var(--line); border-radius: 6px; padding: .5rem .8rem; margin-bottom: .8rem; font-size: .9rem; }
.why summary { cursor: pointer; font-weight: 600; color: var(--accent); }
.why p { margin: .5rem 0; }
table.reasons { border-collapse: collapse; width: 100%; }
table.reasons td { padding: .3rem .4rem; border-top: 1px solid var(--line); vertical-align: top; }
table.reasons td.pts { width: 2.5rem; text-align: right; color: var(--muted); font-weight: 700; }
table.reasons td.pts.neg { color: var(--bad); }
table.reasons code.code { font-size: .78em; margin-right: .3rem; }
.imgbar { background: var(--warn-bg); color: var(--warn); border-radius: 6px; padding: .45rem .8rem; margin-bottom: .6rem;
  font-size: .9rem; }
iframe.body { width: 100%; height: 65vh; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.atts { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.atts li { border: 1px solid var(--line); border-radius: 6px; padding: .35rem .7rem; font-size: .9rem; }
.blocked { color: var(--bad); }
pre.source { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 1rem;
  font: .8rem/1.45 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 1.1rem 1.3rem;
  margin-bottom: 1rem; min-width: 0; }
.card.narrow { max-width: 420px; margin: 2.5rem auto; }
.row-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.crumb { margin: 0; font-size: .9rem; }
label { display: block; margin-bottom: 1rem; font-weight: 600; }
input[type=email], input[type=password], input:not([type]), select, textarea {
  display: block; width: 100%; margin-top: .3rem; padding: .5rem .65rem; font: inherit; font-weight: 400;
  border: 1px solid #c4cad4; border-radius: 6px; background: #fff; }
.addr { display: flex; align-items: center; gap: .3rem; margin-top: .3rem; }
.addr input, .addr select { margin: 0; } .addr span { font-weight: 400; color: var(--muted); white-space: nowrap; }
label.choice { font-weight: 400; display: flex; gap: .5rem; align-items: baseline; }
.hint { font-weight: 400; font-size: .85rem; color: var(--muted); }
p.hint { margin: .4rem 0 0; }
button { background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 6px; padding: .5rem 1.05rem;
  font: inherit; font-weight: 600; cursor: pointer; }
button.link { background: none; color: var(--accent); padding: 0; font-weight: 400; text-decoration: underline; }
form.inline { display: inline; }
.row-form { display: flex; gap: .5rem; flex-wrap: wrap; margin: 1rem 0; }
.row-form input, .row-form select { width: auto; flex: 1 1 14rem; margin: 0; }
.row-form select { flex: 0 0 auto; }
:focus-visible { outline: 3px solid #7aa7e0; outline-offset: 2px; }
.alert { border-radius: 6px; padding: .7rem 1rem; margin-bottom: 1rem; }
.alert ul { margin: 0; padding-left: 1.1rem; }
.alert.error { background: var(--bad-bg); color: var(--bad); }
.muted { color: var(--muted); }

table.list { border-collapse: collapse; width: 100%; background: var(--surface); }
table.list th, table.list td { text-align: left; padding: .5rem .7rem; border-bottom: 1px solid var(--line); }
table.list th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.card-table { border: 1px solid var(--line); border-radius: 8px; }
.steps { padding-left: 1.2rem; } .steps li { margin-bottom: .4rem; }
.records { display: grid; gap: .8rem; }
.record dl { display: grid; grid-template-columns: 4.5rem 1fr; gap: .3rem .8rem; margin: 0; font-size: .9rem; }
.record dt { color: var(--muted); } .record dd { margin: 0; min-width: 0; }
.rec-head { display: flex; justify-content: space-between; align-items: center; }
code.value { display: block; padding: .3rem .5rem; word-break: break-all; }

a.newmsg { display: block; text-align: center; background: var(--accent); color: var(--accent-ink); border-radius: 6px;
  padding: .5rem; margin: 0 .25rem .7rem; font-weight: 600; text-decoration: none; }
.compose { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 1rem 1.2rem; }
.from-line { margin-bottom: .6rem; font-size: .92rem; }
label.field { display: grid; grid-template-columns: 4.5rem 1fr; align-items: center; margin: 0; font-weight: 500;
  border-bottom: 1px solid var(--line); }
label.field span { color: var(--muted); }
label.field input { border: 0; margin: 0; border-radius: 0; padding: .55rem .3rem; }
.compose textarea { margin: .8rem 0; font: 15px/1.5 system-ui, sans-serif; min-height: 16rem; }
.actions { display: flex; gap: .8rem; align-items: center; }
button.secondary { background: var(--surface); color: var(--text); border: 1px solid var(--line); }
.report { margin: .3rem 0 .8rem; } .report h2 { font-size: .95rem; }
.report table.list { font-size: .88rem; border: 1px solid var(--line); }
td.detail { color: var(--muted); overflow-wrap: anywhere; }
.search { margin: 0 .25rem .7rem; }
.search input { width: 100%; margin: 0; padding: .4rem .6rem; border: 1px solid var(--line); border-radius: 6px;
  font: inherit; font-size: .92rem; background: var(--bg); }
a.storage { display: block; margin: 1rem .5rem 0; font-size: .8rem; color: var(--muted); text-decoration: none; }
a.storage:hover { color: var(--text); }
meter.quota { display: block; width: 100%; height: .45rem; margin: .2rem 0; }
td meter.quota { max-width: 9rem; }
.alert.ok { background: var(--good-bg); color: var(--good); }
.tool.danger { color: var(--bad); border-color: var(--bad-bg); }
.hint.pad { margin: -.3rem 0 .6rem; }
.account { max-width: 34rem; }
table.settings { border-collapse: collapse; width: 100%; margin: .5rem 0; }
table.settings th, table.settings td { text-align: left; padding: .35rem .4rem; border-top: 1px solid var(--line); vertical-align: top; }
table.settings th { font-weight: 600; white-space: nowrap; width: 9rem; }
table.settings code { overflow-wrap: anywhere; }
tr.sub td { border-top: 0; padding-top: 0; font-size: .9rem; }
tr.sub summary { cursor: pointer; color: var(--accent); }
form.row { display: flex; gap: .6rem; align-items: flex-end; flex-wrap: wrap; margin: .6rem 0; }
form.row label { margin: 0; flex: 1 1 14rem; font-weight: 500; }
form.row input { margin: .2rem 0 0; }
input[type=number], input[type=search] { font: inherit; }
input[type=number] { width: 100%; padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 6px; }
@media (max-width: 720px) {
  .search { display: inline-block; vertical-align: middle; width: 10rem; margin: 0 .3rem .4rem; }
  a.storage { display: none; }
  a.newmsg { display: inline-block; margin: 0 .3rem .4rem; padding: .35rem .8rem; }
  .mail { display: block; }
  .folders { border-right: 0; border-bottom: 1px solid var(--line); padding: .4rem; overflow-x: auto; }
  .folders ul { display: flex; gap: .2rem; }
  .folders a { white-space: nowrap; gap: .4rem; }
  .folders li[class^="d"] a { padding-left: .75rem; }
  a.manage { display: inline-block; margin: 0 .3rem .4rem; }
  .pane { padding: .8rem .8rem 2rem; }
  .who { display: none; }
  iframe.body { height: 70vh; }
}

/* Public front page */
.landing { flex: 1 0 auto; width: 100%; }
.hero { max-width: 1100px; margin: 0 auto; padding: 3.5rem 1.2rem 2.5rem; display: grid;
  grid-template-columns: 1.1fr 1fr; gap: 2.5rem; align-items: center; }
.hero h1 { font-size: 2.4rem; line-height: 1.15; margin: 0 0 1rem; letter-spacing: -.01em; }
.lead { font-size: 1.12rem; color: var(--muted); margin: 0 0 1.5rem; max-width: 34rem; }
.cta { display: flex; gap: .7rem; flex-wrap: wrap; margin-bottom: .6rem; }
a.button { display: inline-block; background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent);
  border-radius: 6px; padding: .65rem 1.3rem; font-weight: 600; text-decoration: none; }
a.button:hover { filter: brightness(1.1); }
a.button.secondary { background: var(--surface); color: var(--accent); }
.hero-card { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 1.1rem 1.2rem;
  box-shadow: 0 8px 28px rgba(26, 29, 35, .08); font-size: .9rem; min-width: 0; }
.mock-head { display: flex; gap: .5rem; align-items: baseline; flex-wrap: wrap; }
.mock-from { margin: .2rem 0 .8rem; overflow-wrap: anywhere; }
.mock-why { border: 1px solid var(--line); border-radius: 6px; padding: .6rem .7rem; }
.mock-q { font-weight: 600; color: var(--accent); margin-bottom: .3rem; }
.features { max-width: 1100px; margin: 0 auto; padding: 1rem 1.2rem 2.5rem; display: grid;
  grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.features article { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 1.1rem 1.2rem; }
.features h2 { font-size: 1.02rem; margin-bottom: .4rem; }
.features p { margin: 0; color: var(--muted); font-size: .94rem; }
.steps-band, .apps-band { max-width: 1100px; margin: 0 auto; padding: 1rem 1.2rem 2rem; }
.steps-band h2, .apps-band h2 { font-size: 1.25rem; margin-bottom: 1rem; }
.how { list-style: none; counter-reset: step; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.how li { counter-increment: step; display: grid; gap: .25rem; padding-left: 2.6rem; position: relative; }
.how li::before { content: counter(step); position: absolute; left: 0; top: 0; width: 1.9rem; height: 1.9rem; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; display: grid; place-items: center; }
.how span { color: var(--muted); font-size: .94rem; }
.apps-band table.settings { max-width: 40rem; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.apps-band table.settings th, .apps-band table.settings td { padding: .55rem .8rem; }
.apps-band table.settings tr:first-child th, .apps-band table.settings tr:first-child td { border-top: 0; }
.site-foot { text-align: center; color: var(--muted); font-size: .88rem; padding: 1.5rem 1rem 2rem; border-top: 1px solid var(--line); }
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; padding-top: 2rem; gap: 1.5rem; }
  .hero h1 { font-size: 1.85rem; }
  .features, .how { grid-template-columns: 1fr; }
}
