:root {
  color-scheme: dark;
  font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
  background: #091426;
  color: #e9f0f8;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1100px 700px at -10% -10%, rgba(79, 165, 255, 0.24), transparent 60%),
    radial-gradient(850px 550px at 110% 0%, rgba(0, 98, 185, 0.2), transparent 60%),
    linear-gradient(165deg, #0d1d37 0%, #071122 45%, #050b16 100%);
  color: #e9f0f8;
}

.app-shell {
  min-height: 100vh;
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.welcome-screen {
  width: min(1120px, 100%);
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 24px;
  align-items: stretch;
}

.brand-panel,
.auth-card,
.card,
.mail-content {
  background: rgba(8, 18, 34, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(16px);
}

.brand-panel {
  padding: 36px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.auth-card {
  padding: 32px;
}

.brand-badge {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-size: 24px;
  background: linear-gradient(135deg, #2a78ec, #59cbff);
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 0.75rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: #8fd3ff;
}

.brand-panel h1,
.auth-header h2 {
  margin: 0 0 12px;
  line-height: 1.15;
}

.brand-copy,
.auth-header p,
.section-title span,
.mailbox-head p,
.mailbox-head h2,
.topbar-title span {
  margin: 0;
  color: #adc0d7;
  line-height: 1.55;
}

.feature-list {
  list-style: none;
  padding: 0;
  margin: 20px 0 0;
  display: grid;
  gap: 10px;
}

.feature-list li {
  padding-left: 16px;
  position: relative;
  color: #dbe7f4;
}

.feature-list li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: #2d7df6;
}

.form-card,
form {
  display: grid;
  gap: 10px;
}

label {
  font-size: 0.95rem;
  color: #dce7f6;
}

input,
textarea,
button,
select {
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  padding: 12px 14px;
  font: inherit;
  background: rgba(255, 255, 255, 0.05);
  color: #f6f8fb;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: #2d7df6;
  box-shadow: 0 0 0 3px rgba(45, 125, 246, 0.16);
}

button {
  cursor: pointer;
  border: none;
  transition: transform 170ms ease, filter 170ms ease, background 170ms ease;
}

button:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.7;
  cursor: wait;
}

.primary-btn {
  background: linear-gradient(135deg, #2d7df6, #55c4ff);
  color: #fff;
  font-weight: 600;
}

.secondary-btn {
  background: rgba(255, 255, 255, 0.09);
  color: #f6f8fb;
}

.full-width {
  width: 100%;
}

.main-panel {
  width: min(1460px, 100%);
}

.main-panel[hidden] {
  display: none !important;
}

.mail-workspace {
  display: grid;
  grid-template-columns: 70px 260px 1fr;
  gap: 16px;
  align-items: stretch;
}

.icon-rail {
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.rail-group {
  display: grid;
  gap: 12px;
}

.rail-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 16px;
  color: #9fb4cb;
  background: rgba(255, 255, 255, 0.04);
}

.rail-icon.active {
  color: #e7f4ff;
  background: linear-gradient(135deg, #2d7df6, #55c4ff);
}

.folder-panel {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.mailbox-head h2 {
  margin-top: 4px;
  color: #edf5ff;
  font-size: 1rem;
  word-break: break-word;
}

.folder-list {
  display: grid;
  gap: 8px;
}

.folder-item {
  text-align: left;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.04);
  color: #c8d6e7;
  padding: 10px 12px;
}

.folder-item.active {
  color: #fff;
  background: linear-gradient(135deg, #2d7df6, #55c4ff);
}

.mail-status,
.status {
  color: #9ed8ff;
  min-height: 22px;
}

.mail-status.error,
.status.error {
  color: #ff9e9e;
}

.mail-content {
  padding: 16px;
  display: grid;
  gap: 12px;
}

.mail-topbar {
  border-radius: 16px;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.topbar-title h3 {
  margin: 0;
  font-size: 1.03rem;
  color: #f0f7ff;
}

.mail-grid {
  display: grid;
  grid-template-columns: 0.95fr 1.35fr;
  gap: 12px;
  min-height: 420px;
}

.card {
  padding: 16px;
}

.message-list-panel,
.message-read-panel {
  overflow: auto;
}

.message-item {
  padding: 12px;
  border: 1px solid transparent;
  border-radius: 12px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  margin-bottom: 8px;
  background: rgba(255, 255, 255, 0.03);
}

.message-item:hover {
  border-color: rgba(94, 162, 236, 0.36);
  background: rgba(45, 125, 246, 0.12);
}

.message-item.active {
  border-color: rgba(91, 174, 255, 0.55);
  background: rgba(45, 125, 246, 0.2);
}

.message-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.message-meta strong {
  color: #fff;
}

.message-meta span,
.message-item small {
  color: #adbfd3;
  font-size: 0.86rem;
}

.empty-state {
  padding: 18px 0;
  color: #9fb1cb;
  text-align: center;
}

.message-detail pre {
  white-space: pre-wrap;
  word-break: break-word;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 12px;
  border-radius: 12px;
  color: #e7edf7;
  margin: 0;
}

.detail-card {
  display: grid;
  gap: 8px;
}

.detail-card h3 {
  margin: 0;
  color: #fff;
}

.compose-panel {
  border-radius: 16px;
}

.section-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 12px;
}

.section-title h2 {
  margin: 0;
  font-size: 1rem;
}

.welcome-screen.is-hidden {
  display: none;
}

@media (max-width: 1220px) {
  .mail-workspace {
    grid-template-columns: 58px 220px 1fr;
  }

  .mail-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 960px) {
  .welcome-screen,
  .mail-workspace {
    grid-template-columns: 1fr;
  }

  .icon-rail {
    flex-direction: row;
  }

  .rail-group {
    display: flex;
  }
}

@media (max-width: 720px) {
  .app-shell {
    padding: 14px;
  }

  .brand-panel,
  .auth-card,
  .card,
  .mail-content,
  .folder-panel {
    padding: 18px;
  }

  .mail-topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
}
