:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --border: #2d3a4f;
  --text: #e8ecf1;
  --muted: #8b9cb3;
  --accent: #0078d4;
  --accent-hover: #106ebe;
  --error: #f1707b;
  --unread: #4fc3f7;
  --radius: 12px;
  --font: "Segoe UI", Tahoma, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: radial-gradient(ellipse at top, #1e2a3a 0%, var(--bg) 55%);
  color: var(--text);
  line-height: 1.5;
}

.app {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
}

.header {
  text-align: center;
  margin-bottom: 1.75rem;
}

.header h1 {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.subtitle {
  margin: 0.5rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.35rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.card h2 {
  margin: 0 0 1.25rem;
  font-size: 1.15rem;
  font-weight: 600;
}

.intro {
  margin: 0 0 1.25rem;
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.65;
}

.hidden {
  display: none !important;
}

label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.85rem;
  color: var(--muted);
}

input[type="email"],
input[type="password"] {
  width: 100%;
  padding: 0.65rem 0.75rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
}

input:focus {
  outline: 2px solid var(--accent);
  border-color: transparent;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0.7rem 1rem;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn.primary {
  background: var(--accent);
  color: #fff;
}

.btn.primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn.secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn.secondary:hover {
  background: rgba(255, 255, 255, 0.05);
}

.btn.ghost {
  width: auto;
  padding: 0.45rem 0.9rem;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  font-size: 0.85rem;
}

.btn.ghost:hover {
  color: var(--text);
}

.divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.25rem 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.hint {
  margin: 1rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.6;
}

.hint code {
  background: var(--bg);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-size: 0.75rem;
}

.error {
  margin-top: 1rem;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  background: rgba(241, 112, 123, 0.12);
  color: var(--error);
  font-size: 0.88rem;
}

.inbox-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.user-line {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.loading {
  text-align: center;
  color: var(--muted);
  padding: 1.5rem;
  font-size: 0.9rem;
}

.messages {
  list-style: none;
  margin: 0;
  padding: 0;
}

.message {
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.message:hover .msg-subject {
  color: var(--unread);
}

.message:last-child {
  border-bottom: none;
}

.message.unread .msg-subject {
  color: var(--unread);
}

.msg-top {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.msg-from {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.msg-date {
  flex-shrink: 0;
}

.msg-subject {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.msg-preview {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.messages .empty {
  text-align: center;
  color: var(--muted);
  padding: 2rem 0;
  cursor: default;
}

.reader-body {
  margin: 1rem 0 0;
  white-space: pre-wrap;
  font-family: var(--font);
  font-size: 0.92rem;
  line-height: 1.7;
  color: var(--text);
}

#reader .btn.ghost {
  margin-bottom: 1rem;
}

#reader-subject {
  margin: 0;
  font-size: 1.05rem;
}