:root {
  --bg: #1e1f22;
  --bg-2: #232428;
  --s1: #2b2d31;
  --s2: #313338;
  --s3: #383a40;
  --s4: #404249;
  --line: rgba(255, 255, 255, 0.06);
  --line-2: rgba(255, 255, 255, 0.1);
  --fg: #f2f3f5;
  --fg-2: #b5bac1;
  --fg-3: #80848e;
  --blurple: #5865f2;
  --blurple-2: #4752c4;
  --blurple-soft: rgba(88, 101, 242, 0.16);
  --fuchsia: #eb459e;
  --green: #23a55a;
  --yellow: #f0b232;
  --red: #f23f43;
  --r: 16px;
  --font: "Plus Jakarta Sans", "Segoe UI Variable Text", "Segoe UI", ui-sans-serif, system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --display: "Unbounded", "Segoe UI Variable Display", "Segoe UI", ui-sans-serif, system-ui, -apple-system, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; }
a { color: #00a8fc; text-decoration: none; }
.hidden { display: none !important; }

/* ---------- fundo ---------- */
.sky { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: radial-gradient(120% 80% at 50% 0%, #26283a 0%, var(--bg) 60%); }
.sky::before, .sky::after { content: ""; position: absolute; border-radius: 50%; filter: blur(80px); opacity: .55; }
.sky::before { width: 520px; height: 520px; left: -140px; top: -160px; background: var(--blurple); opacity: .28; }
.sky::after { width: 460px; height: 460px; right: -160px; bottom: -180px; background: var(--fuchsia); opacity: .14; }
.stars { position: absolute; inset: 0; background-image:
  radial-gradient(1px 1px at 12% 22%, #fff8, transparent 60%),
  radial-gradient(1px 1px at 72% 12%, #fff6, transparent 60%),
  radial-gradient(1.5px 1.5px at 88% 46%, #fff7, transparent 60%),
  radial-gradient(1px 1px at 34% 78%, #fff5, transparent 60%),
  radial-gradient(1px 1px at 56% 36%, #fff4, transparent 60%),
  radial-gradient(1.5px 1.5px at 20% 58%, #fff6, transparent 60%),
  radial-gradient(1px 1px at 92% 84%, #fff5, transparent 60%),
  radial-gradient(1px 1px at 46% 92%, #fff4, transparent 60%);
  animation: twinkle 6s ease-in-out infinite alternate; }
@keyframes twinkle { to { opacity: .4; } }

/* ---------- marca ---------- */
.logo { display: inline-flex; align-items: center; gap: 10px; user-select: none; }
.logo img { width: 46px; height: auto; filter: drop-shadow(0 4px 12px rgba(88,101,242,.45)); }
.logo .wm { display: flex; flex-direction: column; line-height: 1; }
.logo b { font-family: var(--display); font-weight: 800; font-size: 21px; letter-spacing: -.01em; color: #fff;
  background: linear-gradient(180deg, #fff 30%, #c9cdfb 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.logo small { font-size: 10px; font-weight: 600; letter-spacing: .14em; text-transform: lowercase; color: var(--fg-3); margin-top: 3px; }
.logo small i { font-style: normal; color: var(--fg-2); }

/* ---------- botões / inputs ---------- */
.btn {
  font-family: var(--font); letter-spacing: .01em;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 18px; border: 0; border-radius: 10px; cursor: pointer;
  background: var(--blurple); color: #fff; font-weight: 600; font-size: 15px;
  transition: background .15s, transform .08s, opacity .15s;
}
.btn:hover { background: var(--blurple-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .7; cursor: default; }
.btn.block { width: 100%; }
.btn.green { background: var(--green); }
.btn.green:hover { background: #1a8b4b; }
.icon-btn {
  width: 36px; height: 36px; display: inline-grid; place-items: center; border: 0; border-radius: 10px;
  background: transparent; color: var(--fg-2); cursor: pointer; transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--s3); color: var(--fg); }
.icon-btn.danger:hover { background: rgba(242,63,67,.14); color: var(--red); }
.icon-btn svg, .btn svg { width: 20px; height: 20px; flex: none; }

.input {
  position: relative; display: flex; align-items: center; margin-bottom: 12px;
  background: var(--bg); border: 1px solid var(--line-2); border-radius: 10px; transition: border-color .15s, box-shadow .15s;
}
.input:focus-within { border-color: var(--blurple); box-shadow: 0 0 0 3px var(--blurple-soft); }
.input svg { width: 18px; height: 18px; margin-left: 13px; color: var(--fg-3); flex: none; }
.input input {
  flex: 1; min-width: 0; height: 46px; padding: 0 13px; background: transparent; border: 0; outline: 0;
  color: var(--fg); font: inherit;
}
.input input::placeholder { color: var(--fg-3); }
.input .eye { margin-right: 4px; width: 38px; height: 38px; }
.input .eye svg { margin: 0; }

.spin { width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; animation: rot .7s linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--s1); border: 1px solid var(--line-2); color: var(--fg); padding: 10px 16px; border-radius: 12px;
  font-size: 14px; font-weight: 500; box-shadow: 0 12px 40px rgba(0,0,0,.4); transition: .25s; z-index: 50;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.toast.err { border-color: rgba(242,63,67,.4); }

/* ---------- login ---------- */
.auth { min-height: 100%; display: grid; place-items: center; padding: 24px 16px 40px; }
.auth-box { width: 100%; max-width: 380px; text-align: center; }
.hero { position: relative; height: 170px; margin-bottom: 6px; }
.hero img { width: 230px; height: auto; position: relative; z-index: 1; animation: float 5s ease-in-out infinite; filter: drop-shadow(0 18px 30px rgba(0,0,0,.45)); }
.hero::after { content: ""; position: absolute; left: 50%; bottom: -4px; width: 140px; height: 18px; transform: translateX(-50%);
  background: radial-gradient(closest-side, rgba(0,0,0,.45), transparent); animation: shadow 5s ease-in-out infinite; }
@keyframes float { 0%,100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-12px) rotate(1deg); } }
@keyframes shadow { 0%,100% { transform: translateX(-50%) scale(1); opacity: 1; } 50% { transform: translateX(-50%) scale(.8); opacity: .6; } }
.hero.launch img { animation: launch .9s cubic-bezier(.5,0,.75,0) forwards; }
@keyframes launch { 20% { transform: translateY(6px) rotate(-4deg); } 100% { transform: translate(60px,-120vh) rotate(8deg); } }

.auth .logo { margin: 8px 0 22px; }
.auth .logo b { font-size: 34px; }
.auth .logo .wm { align-items: center; }
.auth .logo small { font-size: 11px; margin-top: 4px; }
.card {
  background: rgba(43,45,49,.82); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 24px 70px -20px rgba(0,0,0,.6);
}
.auth .card { padding: 22px; text-align: left; }
.err { color: var(--red); font-size: 13px; min-height: 0; margin: -2px 0 10px; }
.err:empty { display: none; }
.shake { animation: shake .35s; }
@keyframes shake { 20%,60% { transform: translateX(-6px); } 40%,80% { transform: translateX(6px); } }

.expired { text-align: center; padding: 4px 0 2px; }
.expired .ico { width: 56px; height: 56px; margin: 0 auto 12px; border-radius: 18px; display: grid; place-items: center; background: rgba(240,178,50,.12); color: var(--yellow); }
.expired .ico svg { width: 28px; height: 28px; }
.expired h3 { margin: 0 0 6px; font: 700 17px var(--display); }
.expired p { margin: 0 0 18px; color: var(--fg-3); font-size: 14px; word-break: break-all; }
.link { background: none; border: 0; color: var(--fg-3); cursor: pointer; font-size: 13px; margin-top: 12px; }
.link:hover { color: var(--fg); }
.fade-in { animation: fadein .3s ease both; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } }

.lang { position: fixed; top: 14px; right: 14px; display: flex; gap: 2px; background: rgba(43,45,49,.7); border: 1px solid var(--line); border-radius: 10px; padding: 3px; z-index: 5; }
.lang button { border: 0; background: transparent; color: var(--fg-3); font-size: 11px; font-weight: 700; padding: 4px 8px; border-radius: 7px; cursor: pointer; }
.lang button.on { background: var(--s4); color: var(--fg); }
.app .lang { position: static; }

/* ---------- app ---------- */
.app { height: 100%; display: flex; flex-direction: column; }
.bar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: rgba(30,31,34,.75); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.bar .logo img { width: 38px; }
.bar .logo b { font-size: 17px; }
.bar .grow { flex: 1; }
.addr {
  display: inline-flex; align-items: center; gap: 8px; max-width: 44vw; height: 36px; padding: 0 6px 0 12px;
  background: var(--s1); border: 1px solid var(--line); border-radius: 10px; cursor: pointer; transition: border-color .15s;
}
.addr:hover { border-color: var(--line-2); }
.addr .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(35,165,90,.2); flex: none; }
.addr span { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.addr svg { width: 16px; height: 16px; color: var(--fg-3); flex: none; margin-right: 4px; }

.main { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(300px, 380px) 1fr; }
.list-pane { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; background: rgba(35,36,40,.55); }
.list-head { display: flex; align-items: center; gap: 8px; padding: 14px 12px 8px 18px; }
.list-head h2 { margin: 0; font: 700 15px var(--display); letter-spacing: -.01em; }
.count { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 99px; background: var(--blurple); color: #fff; }
.count:empty { display: none; }
.list-head .grow { flex: 1; }
.list-head .icon-btn.busy svg { animation: rot .8s linear infinite; }
.list { flex: 1; overflow-y: auto; padding: 4px 8px 16px; }

.item {
  display: flex; gap: 12px; align-items: flex-start; padding: 11px 10px; border-radius: 12px; cursor: pointer;
  transition: background .12s; position: relative;
}
.item:hover { background: rgba(78,80,88,.3); }
.item.active { background: rgba(78,80,88,.55); }
.av {
  width: 38px; height: 38px; border-radius: 50%; flex: none; display: grid; place-items: center;
  font-weight: 700; font-size: 15px; color: #fff; text-transform: uppercase;
}
.item .body { flex: 1; min-width: 0; }
.item .row1 { display: flex; align-items: baseline; gap: 8px; }
.item .from { flex: 1; min-width: 0; font-weight: 600; font-size: 14px; color: var(--fg-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .when { font-size: 11px; color: var(--fg-3); flex: none; }
.item .subj { font-size: 13px; color: var(--fg-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.item.unseen .from { color: #fff; }
.item.unseen .subj { color: var(--fg-2); }
.item.unseen::before { content: ""; position: absolute; left: -2px; top: 50%; width: 4px; height: 8px; margin-top: -4px; border-radius: 0 4px 4px 0; background: #fff; }
.item.new { animation: pop .5s ease; }
@keyframes pop { from { background: var(--blurple-soft); } }

.skel { height: 60px; margin: 4px 2px 6px; border-radius: 12px; background: linear-gradient(90deg, var(--s1) 0%, var(--s2) 50%, var(--s1) 100%); background-size: 200% 100%; animation: sk 1.2s linear infinite; }
@keyframes sk { to { background-position: -200% 0; } }

.void { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 30px; color: var(--fg-3); gap: 6px; }
.void img { width: 150px; opacity: .9; animation: float 5s ease-in-out infinite; margin-bottom: 8px; }
.void b { color: var(--fg-2); font-size: 15px; }
.void small { font-size: 13px; }
.radar { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; }
.radar i { width: 8px; height: 8px; border-radius: 50%; background: var(--green); position: relative; }
.radar i::after { content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid var(--green); animation: ping 1.6s ease-out infinite; }
@keyframes ping { from { transform: scale(.4); opacity: 1; } to { transform: scale(1.4); opacity: 0; } }

.reader { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.reader-top { display: flex; align-items: center; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.reader-top .grow { flex: 1; }
.reader-top .back { display: none; }
.reader-scroll { flex: 1; overflow-y: auto; padding: 22px 26px 30px; }
.reader-scroll > * { max-width: 880px; margin-left: auto; margin-right: auto; }
.reader h1 { margin: 0 0 16px; font: 700 21px/1.3 var(--display); letter-spacing: -.015em; word-break: break-word; }
.meta { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.meta .av { width: 42px; height: 42px; }
.meta .who { min-width: 0; flex: 1; }
.meta .who b { display: block; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meta .who span { display: block; font-size: 12px; color: var(--fg-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meta time { font-size: 12px; color: var(--fg-3); flex: none; }
.paper { background: #fff; border-radius: 14px; overflow: hidden; box-shadow: 0 10px 40px -10px rgba(0,0,0,.5); }
.paper iframe { display: block; width: 100%; height: 200px; border: 0; background: #fff; }
.plain { margin: 0; padding: 18px; background: var(--s1); border: 1px solid var(--line); border-radius: 14px; white-space: pre-wrap; word-break: break-word; font: 14px/1.6 var(--font); color: var(--fg-2); }
.plain a { color: #00a8fc; }

.confirm { background: var(--red) !important; color: #fff !important; width: auto !important; padding: 0 12px; gap: 6px; font-size: 13px; font-weight: 600; }

/* ---------- mobile ---------- */
@media (max-width: 820px) {
  .main { grid-template-columns: 1fr; }
  .list-pane { border-right: 0; }
  .reader { display: none; }
  .app.reading .list-pane { display: none; }
  .app.reading .reader { display: flex; }
  .reader-top .back { display: inline-grid; }
  .reader-scroll { padding: 18px 14px 26px; }
.reader h1 { font-size: 19px; }
  .bar { padding: 8px 10px; gap: 8px; }
  .bar .logo .wm { display: none; }
  .addr { max-width: none; flex: 1; min-width: 0; }
  .bar .grow { display: none; }
  .app .lang { display: none; }
  .hero { height: 150px; }
  .hero img { width: 200px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
