:root {
  --bg: #0f1012; --side: #131417; --panel: #17181c; --input: #121316; --hover: #1a1c20; --sel: #1e2025;
  --line: #222429; --line2: #2c2f35; --text: #ececef; --soft: #c4c7ce; --muted: #a0a4ad; --faint: #8a8f99;
  --accent: #3b6fe0; --accent2: #5b8cff; --link: #8fb0ff; --ok: #6ee7b7; --okbg: #12261d; --live: #34d399;
  --danger: #f5a3a3; --mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 14px/1.45 Inter, system-ui, -apple-system, 'Segoe UI', sans-serif; }
a { color: var(--link); text-decoration: none; } a:hover { color: #b9ceff; }
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); } .faint { color: var(--faint); }

/* botões e campos */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line2); background: var(--hover); color: #e6e7ea; font-weight: 500; font-size: 13px; cursor: pointer; white-space: nowrap; }
.btn:hover { background: #22252a; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; } .btn.primary:hover { background: #3466d1; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.danger { color: var(--danger); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12px; }
.btn.icon { width: 36px; padding: 0; }
.btn:disabled { opacity: .5; cursor: default; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field label, .lbl { font-size: 13px; font-weight: 500; color: var(--soft); }
.input { height: 44px; padding: 0 14px; border: 1px solid var(--line2); border-radius: 8px; background: var(--input); color: var(--text); outline: none; width: 100%; }
.input:focus { border-color: var(--accent2); }
.search { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border: 1px solid var(--line2); border-radius: 8px; background: var(--input); }
.search input { flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; font-size: 13px; }
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 5px 9px; border: 1px solid #30333a; border-radius: 7px; background: #1f2126; font: 600 13px var(--mono); color: #fff; cursor: pointer; }
.chip:hover { border-color: var(--accent2); }
.pill { font-size: 12px; padding: 4px 10px; border-radius: 20px; border: 1px solid var(--line2); color: var(--soft); background: transparent; cursor: pointer; }
.pill.on { background: #262930; border-color: #262930; color: #fff; }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 3px 9px; border-radius: 20px; }
.badge.ok { background: var(--okbg); color: var(--ok); } .badge.off { background: #26282d; color: var(--soft); } .badge.warn { background: #2a1f15; color: #f0b27a; }
.card { background: var(--panel); border: 1px solid #25272c; border-radius: 14px; }
.kicker { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 7px; }

/* login */
.login { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 40px 20px; }
.login-box { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 26px; }
.login-box form { padding: 28px; display: flex; flex-direction: column; gap: 18px; }
.logo { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); display: flex; align-items: center; justify-content: center; }
.logo.big { width: 48px; height: 48px; border-radius: 12px; }
.error { color: var(--danger); font-size: 13px; min-height: 18px; }

/* layout do app */
.app { display: flex; height: 100%; }
.side { flex: 0 0 248px; background: var(--side); border-right: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; gap: 22px; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 6px; font-weight: 700; font-size: 16px; }
.nav { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; color: var(--soft); font-size: 14px; cursor: pointer; }
.nav:hover { background: #1c1e22; color: #fff; }
.nav.on { background: var(--sel); color: #fff; }
.nav .n { margin-left: auto; font-size: 12px; color: var(--muted); }
.nav .n.hot { font-weight: 600; background: var(--accent); color: #fff; border-radius: 10px; padding: 1px 7px; }
.nav .addr { flex: 1; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-group { display: flex; flex-direction: column; gap: 2px; }
.side-group .kicker { padding: 0 12px 6px; }
.side-foot { margin-top: auto; padding: 12px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.main { flex: 1; min-width: 0; display: flex; overflow: hidden; }

/* caixa de entrada */
.list { flex: 0 0 420px; max-width: 440px; background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.list-head { padding: 18px 18px 12px; display: flex; align-items: center; gap: 10px; }
.list-head h1 { margin: 0; font-size: 18px; }
.live { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.list-tools { padding: 0 18px 12px; display: flex; flex-direction: column; gap: 10px; }
.list-tools .pills { display: flex; gap: 6px; flex-wrap: wrap; }
.rows { flex: 1; overflow-y: auto; border-top: 1px solid var(--line); }
.row { padding: 14px 18px; border-bottom: 1px solid var(--line); cursor: pointer; }
.row:hover { background: var(--hover); }
.row.on { background: var(--sel); box-shadow: inset 3px 0 0 var(--accent2); }
.row .top { display: flex; align-items: center; gap: 8px; margin-bottom: 3px; font-size: 13px; color: var(--muted); }
.row .from { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .date { font-size: 12px; color: var(--faint); }
.row .subj { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row.unread .subj { color: #fff; }
.row .to { font-size: 12px; color: var(--faint); margin-top: 2px; }
.row .chip { margin-top: 8px; }
.empty { padding: 40px 24px; text-align: center; color: var(--muted); }

.reader { flex: 1; min-width: 0; overflow-y: auto; padding: 24px 32px; display: flex; flex-direction: column; gap: 20px; }
.reader h2 { margin: 0; font-size: 22px; letter-spacing: -.01em; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; }
.sender { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: #1a2236; color: #8fb3ff; display: flex; align-items: center; justify-content: center; font-weight: 700; text-transform: uppercase; }
.codebox { padding: 22px 24px; display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.codebox .code { font: 600 44px var(--mono); letter-spacing: .12em; color: #fff; }
.mailframe { width: 100%; max-width: 760px; min-height: 420px; border: 0; border-radius: 12px; background: #fff; }
.back { display: none; }

/* páginas admin */
.page { flex: 1; overflow-y: auto; padding: 28px 36px; display: flex; flex-direction: column; gap: 22px; }
.page h1 { margin: 0 0 4px; font-size: 24px; letter-spacing: -.01em; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.page-head > div { flex: 1; min-width: 240px; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.stat { padding: 16px 18px; } .stat .v { font-size: 26px; font-weight: 700; } .stat .l { font-size: 13px; color: var(--muted); margin-bottom: 6px; } .stat .h { font-size: 12px; color: var(--faint); margin-top: 4px; }
.tablebar { padding: 14px 16px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; border-bottom: 1px solid #25272c; }
.seg { display: flex; gap: 4px; background: var(--input); border: 1px solid var(--line2); border-radius: 8px; padding: 3px; }
.seg button { height: 30px; padding: 0 12px; border: 0; border-radius: 6px; background: transparent; color: var(--soft); font-weight: 500; font-size: 13px; cursor: pointer; }
.seg button.on { background: #262930; color: #fff; }
.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { font-size: 12px; font-weight: 600; color: var(--faint); text-align: left; padding: 10px 16px; border-bottom: 1px solid #25272c; white-space: nowrap; }
td { font-size: 13px; padding: 12px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td.actions { text-align: right; } td.actions .btn { margin-left: 6px; }
.form { padding: 24px; display: flex; flex-direction: column; gap: 20px; max-width: 640px; flex: 1 1 460px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.domains { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.domopt { display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 14px; border-radius: 10px; background: var(--input); border: 1px solid var(--line2); font: 600 14px var(--mono); cursor: pointer; color: var(--text); }
.domopt .radio { width: 16px; height: 16px; border-radius: 50%; border: 2px solid #4a4e57; }
.domopt.on { border: 2px solid var(--accent); } .domopt.on .radio { border: 5px solid var(--accent2); }
.addrinput { display: flex; align-items: center; border: 1px solid var(--line2); border-radius: 8px; background: var(--input); overflow: hidden; flex: 1; }
.addrinput:focus-within { border-color: var(--accent2); }
.addrinput input { flex: 1; min-width: 0; height: 42px; padding: 0 14px; border: 0; outline: 0; background: transparent; font: 500 14px var(--mono); }
.addrinput span { padding: 0 14px; font: 500 14px var(--mono); color: var(--muted); }
.preview { flex: 1 1 300px; max-width: 420px; display: flex; flex-direction: column; gap: 12px; }
.item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; background: var(--input); font: 500 13px var(--mono); }
.check { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.check .k { width: 60px; font-weight: 600; color: var(--soft); }
.check .v { flex: 1; font: 12px var(--mono); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* aviso flutuante */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); width: max-content; max-width: calc(100vw - 32px); display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 12px; background: #1f2a1f; border: 1px solid #2d4a33; color: #b7f0c8; font-size: 13px; z-index: 50; box-shadow: 0 8px 30px rgba(0,0,0,.4); }

/* celular */
.menu-btn { display: none; }
.scrim { display: none; }
@media (max-width: 900px) {
  .side { position: fixed; inset: 0 auto 0 0; z-index: 40; width: 270px; transform: translateX(-100%); transition: transform .2s; }
  .app.menu .side { transform: none; }
  .app.menu .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 30; }
  .menu-btn { display: inline-flex; }
  .list { flex: 1; max-width: none; border-right: 0; }
  .reader { display: none; padding: 16px 18px; }
  .main.reading .list { display: none; }
  .main.reading .reader { display: flex; }
  .back { display: inline-flex; }
  .codebox { flex-direction: column; align-items: stretch; text-align: center; }
  .codebox .code { font-size: 40px; }
  .page { padding: 18px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid2, .domains { grid-template-columns: 1fr; }
}
