:root {
  color-scheme: dark;
  --bg: #070a12;
  --panel: rgba(16, 22, 38, 0.82);
  --panel-2: rgba(20, 28, 48, 0.92);
  --line: rgba(255, 255, 255, 0.1);
  --text: #f7f9ff;
  --muted: #94a3b8;
  --accent: #7c3aed;
  --accent-2: #06b6d4;
  --danger: #fb7185;
  --ok: #22c55e;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.45);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 15% 15%, rgba(124, 58, 237, 0.32), transparent 28%),
    radial-gradient(circle at 80% 10%, rgba(6, 182, 212, 0.24), transparent 28%),
    linear-gradient(135deg, #070a12 0%, #0e1424 58%, #05070d 100%);
  pointer-events: none;
}
button, input, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.shell { position: relative; min-height: 100vh; display: grid; place-items: center; padding: 28px; }
.login-card {
  width: min(460px, 100%);
  padding: 36px;
  border: 1px solid var(--line);
  border-radius: 32px;
  background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.03));
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
}
.brand-mark {
  width: 62px; height: 62px; display: grid; place-items: center;
  border-radius: 20px; font-size: 30px; font-weight: 900;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 18px 50px rgba(124, 58, 237, 0.45);
}
.brand-mark.small { width: 44px; height: 44px; border-radius: 15px; font-size: 22px; }
h1, h2, p { margin-top: 0; }
p, span { color: var(--muted); }
.form-grid { display: grid; gap: 12px; margin-top: 28px; }
label { color: #cbd5e1; font-size: 13px; font-weight: 700; }
input, textarea {
  width: 100%; color: var(--text); background: rgba(2, 6, 23, 0.72);
  border: 1px solid var(--line); border-radius: 16px; outline: none;
  padding: 14px 16px; transition: border-color .2s, box-shadow .2s, background .2s;
}
input:focus, textarea:focus { border-color: rgba(6, 182, 212, .75); box-shadow: 0 0 0 4px rgba(6, 182, 212, .12); }
.primary, .compose {
  border: 0; color: white; border-radius: 16px; padding: 14px 18px; font-weight: 800;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 16px 36px rgba(6, 182, 212, .18);
}
.ghost, .icon {
  border: 1px solid var(--line); color: var(--text); background: rgba(255,255,255,.05);
  border-radius: 14px; padding: 11px 14px;
}
.status { margin-top: 14px; min-height: 20px; color: var(--danger); }
.app {
  width: min(1500px, 100%); height: min(900px, calc(100vh - 56px));
  display: grid; grid-template-columns: 280px minmax(330px, 430px) 1fr;
  border: 1px solid var(--line); border-radius: 34px; overflow: hidden;
  background: rgba(7, 10, 18, .72); box-shadow: var(--shadow); backdrop-filter: blur(26px);
}
.sidebar, .list-pane, .reader-pane { min-height: 0; }
.sidebar { padding: 22px; border-right: 1px solid var(--line); background: rgba(255,255,255,.035); display: flex; flex-direction: column; gap: 18px; }
.brand-row { display: flex; align-items: center; gap: 12px; }
.brand-row span { display: block; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.folders { display: grid; gap: 8px; }
.folder {
  display: flex; justify-content: space-between; align-items: center; border: 1px solid transparent;
  padding: 12px 14px; border-radius: 14px; color: #dbeafe; background: transparent;
}
.folder.active, .folder:hover { background: rgba(255,255,255,.07); border-color: var(--line); }
.list-pane { border-right: 1px solid var(--line); display: flex; flex-direction: column; background: rgba(15, 23, 42, .42); }
.toolbar { padding: 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.toolbar h2 { margin-bottom: 4px; }
.message-list { overflow: auto; padding: 10px; }
.message-item {
  width: 100%; text-align: left; color: var(--text); border: 1px solid transparent; border-radius: 18px;
  background: transparent; padding: 14px; display: grid; gap: 7px;
}
.message-item:hover, .message-item.active { background: rgba(255,255,255,.06); border-color: var(--line); }
.message-item.unseen .subject { font-weight: 900; }
.message-meta { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 12px; }
.subject { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reader-pane { overflow: auto; background: rgba(2, 6, 23, .32); }
.empty-state { min-height: 100%; display: grid; place-content: center; justify-items: center; text-align: center; padding: 28px; }
.orb { width: 118px; height: 118px; border-radius: 999px; background: radial-gradient(circle, rgba(6,182,212,.96), rgba(124,58,237,.15) 64%, transparent 70%); filter: blur(.2px); }
.message-reader { padding: 34px; }
.message-reader header { padding-bottom: 20px; border-bottom: 1px solid var(--line); margin-bottom: 22px; }
.message-reader h2 { font-size: clamp(24px, 3vw, 42px); }
.mail-field { color: var(--muted); margin: 7px 0; word-break: break-word; }
.mail-body { white-space: pre-wrap; line-height: 1.7; color: #e5e7eb; }
.compose-dialog {
  width: min(760px, calc(100vw - 28px)); border: 1px solid var(--line); border-radius: 26px;
  background: var(--panel-2); color: var(--text); box-shadow: var(--shadow); padding: 0;
}
.compose-dialog::backdrop { background: rgba(0,0,0,.66); backdrop-filter: blur(6px); }
.compose-dialog form { display: grid; gap: 12px; padding: 20px; }
.dialog-head, .dialog-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dialog-head h2 { margin: 0; }
.icon { width: 42px; height: 42px; padding: 0; font-size: 24px; }
textarea { min-height: 240px; resize: vertical; }
#composeStatus { color: var(--muted); }
@media (max-width: 1050px) {
  .app { grid-template-columns: 230px 1fr; }
  .reader-pane { display: none; }
}
@media (max-width: 760px) {
  .shell { padding: 0; }
  .app { height: 100vh; border-radius: 0; grid-template-columns: 1fr; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); }
  .list-pane { border-right: 0; }
}
