/* Bit-Bite Mail Gateway - styled after bit-bite.com: white pages, blue 135deg gradient, Kanit + Bakbak One */
:root {
  --app: #1E7FD0; --appd: #155FA8; --appl: #3C9BE0;
  --green: #8BC532; --greend: #76AD27;
  --ink: #1d2a38; --muted: #6d6e71; --line: #e3e9f1; --bg: #f4f7fb;
  --red: #d9534f; --amber: #f0a020;
  --grad: linear-gradient(135deg, var(--app) 0%, var(--appd) 100%);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: Kanit, 'Segoe UI', Arial, sans-serif; font-weight: 300; color: var(--ink); background: var(--bg); font-size: 15px; line-height: 1.5; }
a { color: var(--app); text-decoration: none; }
a:hover { color: var(--appd); text-decoration: underline; }
b, strong, th, dt { font-weight: 500; }
h1, h2 { font-family: 'Bakbak One', Kanit, sans-serif; font-weight: 400; letter-spacing: .2px; }
h2 { font-size: 19px; color: var(--app); margin: 0 0 10px; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 20px; }

/* header */
.top { background: #fff; box-shadow: 0 2px 14px rgba(21, 95, 168, .08); position: sticky; top: 0; z-index: 10; }
.top::after { content: ""; display: block; height: 3px; background: var(--grad); }
.topbar { display: flex; align-items: center; gap: 22px; min-height: 68px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand img { height: 38px; width: auto; display: block; }
.brand span { font-family: 'Bakbak One', Kanit, sans-serif; font-size: 15px; color: var(--muted); padding-left: 12px; border-left: 2px solid var(--line); text-transform: uppercase; letter-spacing: .8px; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.nav a { color: var(--ink); padding: 8px 12px; border-radius: 6px; font-weight: 400; position: relative; }
.nav a:hover { background: #eef5fc; text-decoration: none; }
.nav a.on { color: var(--app); font-weight: 500; }
.nav a.on::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: 2px; height: 3px; border-radius: 3px; background: var(--grad); }
.who { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.role { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; padding: 2px 8px; border-radius: 10px; background: #eef5fc; color: var(--app); font-weight: 500; }
.role.admin { background: var(--grad); color: #fff; }

/* hero band */
.hero { background: var(--grad); color: #fff; padding: 26px 0 30px; margin-bottom: 22px; position: relative; overflow: hidden; }
.hero::before { content: ""; position: absolute; right: -80px; top: -120px; width: 360px; height: 360px; border-radius: 50%; background: rgba(255, 255, 255, .07); }
.hero h1 { margin: 0; font-size: 34px; line-height: 1.1; position: relative; }
.hero p { margin: 8px 0 0; color: rgba(255, 255, 255, .9); max-width: 900px; position: relative; }
.hero a, .herolink { color: #fff; }
.herofilter { margin-top: 12px; display: flex; gap: 8px; position: relative; }
.herofilter select { border: 0; }

/* cards & layout */
main { min-height: 50vh; }
.card { background: #fff; border-radius: 12px; padding: 18px 20px; margin-bottom: 20px; box-shadow: 0 1px 3px rgba(29, 42, 56, .06), 0 6px 24px rgba(21, 95, 168, .05); }
.card.narrow { max-width: 460px; margin: 10px auto 30px; }
.cardhead { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.cardhead p { margin: 2px 0 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid2 > .card { margin-bottom: 20px; min-width: 0; }
@media (max-width: 900px) { .grid2 { grid-template-columns: 1fr; } .hero h1 { font-size: 27px; } }

/* tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 20px; }
.tile { background: #fff; border-radius: 12px; padding: 14px 16px; box-shadow: 0 1px 3px rgba(29, 42, 56, .06); position: relative; overflow: hidden; }
.tile::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--grad); }
.tile b { display: block; font-family: 'Bakbak One', Kanit, sans-serif; font-weight: 400; font-size: 30px; color: var(--app); line-height: 1.1; }
.tile span { font-size: 13px; color: var(--muted); }

/* chart */
.chart { width: 100%; height: auto; display: block; }
.chart text { font-size: 10px; fill: var(--muted); font-family: Kanit, sans-serif; }
.c-ok { fill: var(--green); } .c-held { fill: var(--amber); } .c-ref { fill: var(--app); }
.legend { font-size: 13px; color: var(--muted); display: flex; gap: 12px; align-items: center; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: -6px; }
.legend i.c-ok { background: var(--green); } .legend i.c-held { background: var(--amber); } .legend i.c-ref { background: var(--app); }

/* tables */
.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); padding: 8px; border-bottom: 2px solid var(--line); white-space: nowrap; }
td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: break-word; }
td.addr { white-space: nowrap; }
td.detail { max-width: 360px; min-width: 200px; }
tr:hover td { background: #f7fbff; }
tr.dim td { opacity: .55; }
.nowrap { white-space: nowrap; }
.muted { color: var(--muted); font-size: 13px; }
.center { text-align: center; }

/* forms */
input, select { font: inherit; font-size: 14px; font-weight: 300; padding: 8px 10px; border: 1px solid #cfd9e5; border-radius: 7px; background: #fff; color: var(--ink); max-width: 100%; }
input:focus, select:focus { outline: 2px solid rgba(30, 127, 208, .35); border-color: var(--app); }
label { display: block; margin-bottom: 12px; font-size: 14px; font-weight: 400; }
label input { display: block; width: 100%; margin-top: 4px; }
label.inline { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-weight: 300; }
label.inline input { width: auto; display: inline-block; margin: 0; }
.code { font-size: 22px; letter-spacing: 6px; text-align: center; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.filters input[name=q] { flex: 1; min-width: 200px; }
.addlist .row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 10px; }
.addlist .grow { flex: 1; min-width: 220px; }
.bulk { display: flex; flex-wrap: wrap; gap: 10px 26px; align-items: center; padding: 10px 14px; background: #f2f7fd; border-radius: 8px; margin-bottom: 6px; }
.bulkgroup { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.bulkgroup + .bulkgroup { padding-left: 26px; border-left: 2px solid #dbe7f4; }
.bulklabel { font-size: 13px; color: var(--muted); font-weight: 400; }
@media (max-width: 700px) { .bulkgroup + .bulkgroup { padding-left: 0; border-left: 0; } }
.rowact { display: inline-flex; gap: 4px; align-items: center; flex-wrap: wrap; margin: 2px 0; }
.exports { display: flex; gap: 8px; flex-wrap: wrap; }
.emailbox { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 12px; margin: 6px 0 12px; background: #f2f7fd; border-radius: 8px; }
.emailbox[hidden] { display: none; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.steps { padding-left: 20px; }
.qr { text-align: center; margin: 8px 0; }
.qr svg { width: 220px; height: 220px; }
code { background: #f2f6fb; padding: 2px 6px; border-radius: 5px; font-size: 13px; }

/* buttons */
.btn { display: inline-block; border: 0; border-radius: 7px; padding: 9px 18px; font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; color: #fff; background: var(--grad); text-decoration: none; line-height: 1.2; transition: filter .15s, background .15s, transform .05s; }
.btn:hover { filter: brightness(1.08); color: #fff; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.sm, select.sm, input.sm { padding: 5px 10px; font-size: 13px; }
.btn.green { background: var(--green); }
.btn.green:hover { background: var(--greend); filter: none; }
.btn.green.outline { background: #fff; color: var(--greend); box-shadow: inset 0 0 0 1.5px var(--green); }
.btn.green.outline:hover { background: var(--green); color: #fff; }
.btn.red { background: var(--red); }
.btn.ghost { background: #fff; color: var(--app); box-shadow: inset 0 0 0 1.5px #cfe0f2; }
.btn.ghost:hover { background: #eef5fc; color: var(--appd); filter: none; }
.btn.white { background: #fff; color: var(--app); }
.link { font-weight: 400; white-space: nowrap; }

/* notes and pills */
.note { padding: 11px 14px; border-radius: 8px; background: #eef5fc; margin-bottom: 16px; border-left: 4px solid var(--app); }
.note.ok { background: #eef8e2; border-color: var(--green); }
.note.err { background: #fdecea; border-color: var(--red); }
.note.warn { background: #fff5e0; border-color: var(--amber); }
.pill { display: inline-block; padding: 1px 9px; border-radius: 10px; font-size: 12px; background: #eef1f5; white-space: nowrap; font-weight: 400; }
.pill.virus, .pill.phishing, .pill.attachment, .pill.spoof, .pill.blocked { background: #fde2e1; color: #a12622; }
.pill.quarantined { background: #fff1d6; color: #8a5a00; }
.pill.delivered, .pill.sent, .pill.released, .pill.allowed { background: #eaf6dc; color: #3e6b00; }
.pill.spam, .pill.size, .pill.unknown_rcpt, .pill.relay, .pill.auth, .pill.sender { background: #e6f0fb; color: var(--appd); }
pre { white-space: pre-wrap; word-break: break-word; background: #f6f9fc; padding: 12px; border-radius: 8px; font-size: 13px; max-height: 460px; overflow: auto; }
dl.facts { display: grid; grid-template-columns: 130px 1fr; gap: 6px 14px; margin: 0; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; word-break: break-word; }
.foot { color: var(--muted); font-size: 13px; padding: 10px 20px 30px; }
.chart a rect { cursor: pointer; transition: opacity .15s; }
.chart a:hover rect { opacity: .78; }
a.tile { display: block; color: inherit; text-decoration: none; transition: transform .15s, box-shadow .15s; }
a.tile:hover { text-decoration: none; transform: translateY(-2px); box-shadow: 0 8px 24px rgba(21, 95, 168, .14); }
a.tile:hover span { color: var(--app); }
textarea { font: inherit; font-size: 14px; font-weight: 300; padding: 8px 10px; border: 1px solid #cfd9e5; border-radius: 7px; width: 100%; color: var(--ink); }
