:root {
  --bg: #f5f6f4; --card: #fff; --ink: #1b2421; --muted: #66706c; --line: #e2e6e3;
  --brand: #0f766e; --brand-2: #115e59; --brand-ink: #fff; --tint: #e6f4f1;
  --ok: #157347; --ok-bg: #e4f4ea; --warn: #9a5b00; --warn-bg: #fff3dc; --bad: #b4322a; --bad-bg: #fde9e7;
  --protect: #4c51bf; --protect-bg: #ebecfb; --shadow: 0 1px 2px rgba(16, 24, 20, .05);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111614; --card: #19201d; --ink: #e5ebe8; --muted: #93a09a; --line: #2b3531;
    --brand: #2bb3a3; --brand-2: #39c7b6; --brand-ink: #062521; --tint: #13302b;
    --ok: #5dd398; --ok-bg: #143322; --warn: #f0b75a; --warn-bg: #362a12; --bad: #f2877e; --bad-bg: #3a1916;
    --protect: #a5a9ff; --protect-bg: #23254a; --shadow: none;
  }
}
* { box-sizing: border-box; }
html { color-scheme: light dark; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--brand); text-decoration: none; } a:hover { text-decoration: underline; }
h1 { font-size: 1.55rem; margin: .2rem 0 .3rem; letter-spacing: -.01em; } h2 { font-size: 1.2rem; margin: 2rem 0 .8rem; }
h2.flat { margin: 0; } h3 { margin: 0 0 .3rem; font-size: 1rem; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .right { text-align: right; } .center { text-align: center; }
.nowrap { white-space: nowrap; } .num { font-variant-numeric: tabular-nums; }

.topbar { display: flex; align-items: center; gap: 1.5rem; padding: .65rem 1.5rem; background: var(--card); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: .5rem; color: var(--ink); font-weight: 700; font-size: 1.05rem; flex: 1; }
.brand:hover { text-decoration: none; }
.logo { width: 24px; height: 24px; border-radius: 7px; background: var(--brand) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M8 11h16v10H8z' fill='none' stroke='white' stroke-width='2.4'/%3E%3Cpath d='M8 11l8 6 8-6' fill='none' stroke='white' stroke-width='2.4'/%3E%3C/svg%3E") center/100% no-repeat; display: inline-block; }
.logo.big { width: 48px; height: 48px; border-radius: 13px; }
.logout { margin: 0; display: flex; align-items: center; gap: .5rem; }

main { max-width: 1000px; margin: 1.5rem auto 6rem; padding: 0 1.5rem; }
main.wide { max-width: 1200px; } main.narrow { max-width: 420px; margin-top: 8vh; } main.wideish { max-width: 560px; margin-top: 2rem; }
.hero-brand { text-align: center; margin-bottom: 1.4rem; } .hero-brand .logo { margin-bottom: .6rem; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 1rem 1.15rem; margin-bottom: .9rem; box-shadow: var(--shadow); }
.card.flush { padding: 0; overflow-x: auto; } .pad { padding: .8rem 1.15rem; }
.card.info { background: var(--tint); border-color: transparent; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .8rem; }
.card.provider, .card.mailbox { display: flex; flex-direction: column; gap: .3rem; color: var(--ink); margin: 0; }
.card.provider:hover, .card.mailbox:hover { border-color: var(--brand); text-decoration: none; }
.card.demo { border-style: dashed; } .card.demo button { margin-top: .4rem; align-self: flex-start; }
.stack { display: flex; flex-direction: column; gap: .8rem; }
.row { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; } .row.between { justify-content: space-between; }
.grid2 { display: grid; grid-template-columns: 2fr 1fr; gap: .8rem; }
form { margin: 0; }

label { display: flex; flex-direction: column; gap: .25rem; font-weight: 500; font-size: .9rem; }
label.check, label.inline { flex-direction: row; align-items: center; gap: .45rem; font-weight: 400; }
fieldset { border: 0; padding: 0; margin: .6rem 0 0; gap: 1.2rem; } legend { margin-bottom: .3rem; padding: 0; }
input, select, textarea { font: inherit; padding: .48rem .6rem; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: inherit; }
input[type=checkbox], input[type=radio] { width: 1rem; height: 1rem; accent-color: var(--brand); padding: 0; }
input:focus-visible, select:focus-visible, button:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
input.tiny { width: 4.5rem; }
button, .button { font: inherit; font-weight: 500; padding: .45rem .9rem; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; display: inline-block; white-space: nowrap; }
button:hover, .button:hover { border-color: var(--muted); text-decoration: none; }
button.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
button.primary:hover { background: var(--brand-2); }
button.big { padding: .65rem 1.4rem; font-size: 1rem; }
button.small { padding: .25rem .6rem; font-size: .85rem; }
button.link { border: 0; background: none; color: var(--brand); padding: .3rem .4rem; }
button.danger { background: var(--bad); border-color: var(--bad); color: #fff; align-self: flex-start; }
button[disabled] { opacity: .5; cursor: not-allowed; }

.flash { padding: .65rem 1rem; border-radius: 10px; margin-bottom: 1rem; background: var(--tint); }
.flash.bad { background: var(--bad-bg); color: var(--bad); } .flash.ok { background: var(--ok-bg); color: var(--ok); }

.acct-head { margin-bottom: .6rem; }
.tabs { display: flex; gap: .2rem; border-bottom: 1px solid var(--line); margin-bottom: 1.1rem; }
.tabs a { padding: .5rem .9rem; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500; }
.tabs a.on { color: var(--ink); border-color: var(--brand); } .tabs a:hover { text-decoration: none; color: var(--ink); }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: .8rem; margin-bottom: 1rem; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: .8rem 1rem; box-shadow: var(--shadow); }
.stat .n { font-size: 1.6rem; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat.good .n { color: var(--ok); }

.banner { padding: .7rem 1rem; } .banner.ok { background: var(--ok-bg); border-color: transparent; }
.banner.warn { background: var(--warn-bg); border-color: transparent; } .banner.bad { background: var(--bad-bg); border-color: transparent; }
.progress .bar { height: 6px; background: var(--line); border-radius: 3px; margin-top: .5rem; overflow: hidden; }
.progress .bar span { display: block; height: 100%; background: var(--brand); transition: width .4s; }

.toolbar { margin: .4rem 0 .8rem; }
.pills { display: flex; gap: .25rem; flex-wrap: wrap; }
.pills a { padding: .3rem .75rem; border-radius: 999px; color: var(--muted); font-size: .9rem; font-weight: 500; }
.pills a.on { background: var(--ink); color: var(--bg); } .pills a:hover { text-decoration: none; color: var(--ink); } .pills a.on:hover { color: var(--bg); }
.pills .count { background: var(--bad); color: #fff; border-radius: 999px; padding: 0 .4rem; font-size: .75rem; margin-left: .15rem; }
.toolbar input[type=search] { width: 14rem; }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: .6rem .8rem; border-bottom: 1px solid var(--line); }
td { padding: .55rem .8rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
table.senders tbody tr { cursor: pointer; } table.senders tbody tr:hover { background: var(--tint); }
table.senders tbody tr:has(input:checked) { background: var(--tint); }
td.check, th.check { width: 2.4rem; padding-right: 0; }
a.sender { display: flex; flex-direction: column; color: var(--ink); line-height: 1.3; } a.sender:hover { text-decoration: none; } a.sender:hover strong { text-decoration: underline; }
td.status { white-space: nowrap; }
td.empty { text-align: center; color: var(--muted); padding: 2.5rem; }
tr.muted td { opacity: .6; }
.tag { display: inline-block; font-size: .75rem; font-weight: 600; padding: .1rem .5rem; border-radius: 999px; background: var(--line); color: var(--ink); }
.tag.ok { background: var(--ok-bg); color: var(--ok); } .tag.warn { background: var(--warn-bg); color: var(--warn); }
.tag.bad { background: var(--bad-bg); color: var(--bad); } .tag.protect { background: var(--protect-bg); color: var(--protect); }

.actionbar { position: fixed; left: 50%; bottom: 1.2rem; transform: translateX(-50%); display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; justify-content: center;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: .6rem .8rem; box-shadow: 0 8px 30px rgba(0,0,0,.18); z-index: 10; max-width: calc(100vw - 2rem); }
.actionbar[hidden] { display: none; }
.actionbar > span { padding: 0 .4rem; }

ul.links { columns: 2; margin: .5rem 0 0; padding-left: 1.1rem; }
.danger-zone { margin-top: 2.5rem; } .danger-zone summary { cursor: pointer; color: var(--muted); margin-bottom: .6rem; }

@media (max-width: 760px) {
  main { padding: 0 1rem; } .topbar { padding: .6rem 1rem; } .logout .muted { display: none; }
  .stats { grid-template-columns: 1fr 1fr; } .hide-sm { display: none; } .grid2 { grid-template-columns: 1fr; }
  .toolbar input[type=search] { width: 100%; } .toolbar form { width: 100%; } ul.links { columns: 1; }
  .actionbar { left: .5rem; right: .5rem; transform: none; bottom: .5rem; max-width: none; }
}
