:root{
  --bg:#070A12;
  --bg2:#090E1A;

  --panel:#0D1426;
  --panel2:#0B1224;

  --text:#EAF1FF;
  --muted:#98A7C6;

  --border:rgba(148,163,184,.14);
  --border2:rgba(148,163,184,.22);

  --primary:#4F86FF;
  --danger:#FF5B6E;

  --radius:16px;
  --radius2:14px;

  --shadow:0 18px 60px rgba(0,0,0,.42);
  --shadow2:0 10px 26px rgba(0,0,0,.24);

  --max:1120px;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  color:var(--text);
  background:
    radial-gradient(900px 420px at 12% -6%, rgba(79,134,255,.12), transparent 58%),
    radial-gradient(820px 420px at 88% -8%, rgba(99,102,241,.10), transparent 56%),
    linear-gradient(180deg, var(--bg), var(--bg2));
}

a{color:inherit; text-decoration:none}
.container{max-width:var(--max); margin:0 auto; padding:22px 16px}

/* Topbar */
.topbar{
  position:sticky; top:0; z-index:50;
  background: rgba(7,10,18,.70);
  backdrop-filter: blur(12px);
  border-bottom:1px solid var(--border);
}
.topbar-inner{
  max-width:var(--max); margin:0 auto;
  padding:14px 16px;
  display:flex; align-items:center; justify-content:space-between; gap:12px;
}

.brand{display:flex; align-items:center; gap:12px; min-width:0}
.logo{
  width:38px; height:38px;
  border-radius:12px;
  object-fit:cover;
  border:1px solid rgba(148,163,184,.18);
  background: rgba(15,23,42,.55);
  box-shadow: 0 10px 20px rgba(0,0,0,.22);
  flex:0 0 auto;
}
.brand h1{
  margin:0; font-size:14px; letter-spacing:.2px;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.brand .sub{
  margin-top:2px; font-size:12px; color:var(--muted);
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.actions{display:flex; gap:10px; align-items:center; flex-wrap:wrap; justify-content:flex-end}

/* Buttons */
.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid var(--border2);
  background: rgba(13,20,38,.55);
  color:var(--text);
  cursor:pointer;
  transition: transform .06s ease, background .15s ease, border .15s ease, box-shadow .15s ease;
}
.btn:hover{
  background: rgba(13,20,38,.80);
  border-color: rgba(148,163,184,.32);
  box-shadow: 0 12px 28px rgba(0,0,0,.18);
}
.btn:active{transform: translateY(1px)}

.btn.primary{
  border-color: rgba(79,134,255,.32);
  background: linear-gradient(180deg, rgba(79,134,255,.22), rgba(13,20,38,.55));
  color:#EAF1FF;
  font-weight:800;
}
.btn.primary:hover{
  border-color: rgba(79,134,255,.48);
}

.btn.danger{
  border:1px solid rgba(255,91,110,.34);
  background: rgba(255,91,110,.10);
  color:#FFE3E8;
}
.btn.danger:hover{border-color: rgba(255,91,110,.55)}

/* Cards */
.card{
  border-radius: var(--radius);
  border:1px solid var(--border);
  background: linear-gradient(180deg, rgba(13,20,38,.88), rgba(11,18,36,.88));
  box-shadow: var(--shadow2);
  padding:18px;
}
.card h2{margin:0 0 10px; font-size:15px; letter-spacing:.2px}
.muted{color:var(--muted)}
.small{font-size:12px}
.sep{height:1px; background: rgba(148,163,184,.12); margin:14px 0}

/* Layout */
.grid{
  display:grid;
  grid-template-columns: 1.25fr .75fr;
  gap:16px;
  align-items:start;
}

/* Forms */
.field{display:flex; flex-direction:column; gap:6px; margin-top:10px}
.field label{font-size:12px; color:var(--muted)}
.input, .select{
  width:100%;
  padding:11px 12px;
  border-radius:12px;
  border:1px solid rgba(148,163,184,.16);
  background: rgba(7,10,18,.46);
  color: var(--text);
  outline:none;
}
.input::placeholder{color: rgba(152,167,198,.72)}
.input:focus, .select:focus{
  border-color: rgba(79,134,255,.45);
  box-shadow: 0 0 0 4px rgba(79,134,255,.12);
}

/* Inbox list */
.list{display:flex; flex-direction:column; gap:10px; margin-top:12px}
.item{
  display:block;
  border-radius: var(--radius2);
  border:1px solid rgba(148,163,184,.14);
  background: rgba(7,10,18,.34);
  padding:12px 12px;
  transition: border .15s ease, background .15s ease, transform .06s ease;
}
.item:hover{
  border-color: rgba(148,163,184,.28);
  background: rgba(7,10,18,.50);
}
.item:active{transform: translateY(1px)}
.item.unseen{
  border-left: 3px solid var(--primary);
  padding-left: 11px;
}

.item .top{
  display:flex; justify-content:space-between;
  gap:10px; align-items:center;
}
.item .from{
  font-weight:800; font-size:13px;
  max-width:65%;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.item .date{
  font-size:12px; color:var(--muted);
  white-space:nowrap;
}
.item .subj{
  margin-top:6px;
  font-size:13px;
  color: rgba(234,241,255,.92);
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}

/* Badge */
.badge{
  display:inline-flex; align-items:center; justify-content:center;
  min-width:22px; height:22px; padding:0 8px;
  border-radius:999px;
  font-size:12px; font-weight:900;
  background: rgba(79,134,255,.14);
  border:1px solid rgba(79,134,255,.28);
  color: #D7E6FF;
}

/* Mailbox box */
.mailbox{
  border-radius: var(--radius2);
  border:1px solid rgba(148,163,184,.14);
  background: rgba(7,10,18,.34);
  padding:12px;
}

/* View email container */
.letter{
  border-radius: var(--radius2);
  border:1px solid rgba(148,163,184,.14);
  background: rgba(7,10,18,.30);
  padding:14px;
}
.mailmeta{display:flex; flex-direction:column; gap:6px; font-size:13px; color: rgba(234,241,255,.92)}
.mailmeta b{color:#fff}

/* iframe view */
iframe.mailframe{
  width:100%;
  height: 70vh;
  border-radius: var(--radius2);
  border:1px solid rgba(148,163,184,.14);
  background: rgba(7,10,18,.30);
}

/* Alerts */
.alert{
  padding:10px 12px; border-radius:12px;
  border:1px solid rgba(255,91,110,.34);
  background: rgba(255,91,110,.10);
  color:#FFE3E8;
  margin:10px 0;
}
.ok{
  padding:10px 12px; border-radius:12px;
  border:1px solid rgba(79,134,255,.24);
  background: rgba(79,134,255,.10);
  color:#EAF1FF;
  margin:10px 0;
}

/* Responsive */
@media (max-width: 920px){
  .grid{grid-template-columns: 1fr}
  .container{padding:18px 12px}
}
@media (max-width: 520px){
  .brand .sub{display:none}
  .btn{padding:9px 10px}
}
