:root {
  color-scheme: dark;
  --bg: #0b1220;
  --panel: #111c2f;
  --panel-2: #0d1626;
  --line: #243553;
  --line-soft: #1a2a44;
  --text: #eef5ff;
  --muted: #9ba9c2;
  --accent: #38d99f;
  --accent-2: #4aa3ff;
  --danger: #ff4d5d;
  --warn: #f8c25c;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(420px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.auth-card h1 {
  margin: 0 0 8px;
  font-size: 26px;
}

.auth-card p {
  margin: 0 0 24px;
  color: var(--muted);
  line-height: 1.5;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.field label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

.input,
.address-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #08111f;
  color: var(--text);
  outline: 0;
  padding: 12px 13px;
}

.input:focus,
.address-input:focus {
  border-color: var(--accent-2);
}

.primary,
.ghost,
.icon-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 40px;
  color: var(--text);
  background: #13223a;
}

.primary {
  width: 100%;
  border-color: #2d9f78;
  background: #1d8d69;
  font-weight: 800;
}

.ghost {
  padding: 0 13px;
}

.ghost:hover,
.icon-button:hover {
  border-color: var(--accent-2);
}

.auth-switch {
  margin-top: 16px;
  color: var(--muted);
  text-align: center;
}

.link-button {
  border: 0;
  background: transparent;
  color: var(--accent-2);
  padding: 0;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 268px minmax(380px, 1fr) minmax(360px, 46vw);
}

.sidebar {
  border-right: 1px solid var(--line);
  background: var(--panel);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.brand {
  padding: 20px 22px;
  border-bottom: 1px solid var(--line-soft);
}

.avatar {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  margin-right: 10px;
  border-radius: 8px;
  background: #3191ff;
  color: white;
  font-size: 13px;
  font-weight: 900;
  vertical-align: top;
}

.brand-name {
  display: inline-block;
  max-width: 172px;
  font-size: 18px;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.brand-domain {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.side-section {
  padding: 18px 14px;
  border-bottom: 1px solid var(--line-soft);
}

.side-title {
  padding: 0 9px 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.address-form {
  display: grid;
  grid-template-columns: 1fr 42px;
  gap: 8px;
  margin-bottom: 12px;
}

.icon-button {
  display: grid;
  place-items: center;
  padding: 0;
}

.address-list,
.mail-list {
  display: grid;
  gap: 8px;
}

.address-item,
.filter-item {
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 40px;
  padding: 0 10px;
  text-align: left;
}

.address-item span,
.filter-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.address-item.active,
.filter-item.active {
  border-color: #3678b7;
  background: #193d62;
}

.logout {
  margin-top: auto;
  padding: 18px 22px;
}

.logout button {
  border: 0;
  background: transparent;
  color: var(--danger);
  font-weight: 800;
}

.inbox {
  min-width: 0;
  border-right: 1px solid var(--line);
  background: var(--panel-2);
}

.topbar {
  min-height: 98px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
}

.topbar h1 {
  margin: 0 0 6px;
  font-size: 22px;
  overflow-wrap: anywhere;
}

.topbar p {
  margin: 0;
  color: var(--muted);
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--accent);
  color: #02140f;
  font-size: 13px;
  font-weight: 900;
}

.mail-count {
  height: 54px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}

.mail-row {
  width: 100%;
  min-height: 46px;
  display: grid;
  grid-template-columns: minmax(120px, 220px) 1fr auto;
  gap: 12px;
  align-items: center;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  background: transparent;
  color: var(--text);
  padding: 0 20px;
  text-align: left;
}

.mail-row:hover,
.mail-row.active {
  background: #111f34;
}

.sender,
.subject {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 800;
}

.mail-row.read .sender,
.mail-row.read .subject {
  color: #c7d0df;
  font-weight: 650;
}

.dot {
  width: 8px;
  height: 16px;
  border-radius: 999px;
  background: var(--accent);
  display: inline-block;
  margin-right: 8px;
  vertical-align: middle;
}

.otp {
  display: inline-flex;
  margin-left: 8px;
  border: 1px solid #bc8731;
  border-radius: 999px;
  padding: 2px 8px;
  color: var(--warn);
  font-size: 12px;
  font-weight: 900;
}

.date {
  color: var(--muted);
  font-size: 14px;
}

.detail {
  min-width: 0;
  background: var(--bg);
}

.empty-detail {
  height: 100vh;
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
}

.empty-detail svg {
  display: block;
  margin: 0 auto 16px;
  color: #6e7b91;
}

.detail-header {
  min-height: 98px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
}

.detail-header h2 {
  margin: 0 0 12px;
  font-size: 21px;
  overflow-wrap: anywhere;
}

.meta {
  color: var(--muted);
  font-size: 14px;
  display: grid;
  gap: 4px;
}

.detail-body {
  padding: 24px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.notice {
  margin: 12px 0 0;
  color: var(--danger);
  min-height: 20px;
}

@media (max-width: 1040px) {
  .app-shell {
    grid-template-columns: 240px 1fr;
  }

  .detail {
    display: none;
  }
}

@media (max-width: 760px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
  }

  .topbar,
  .mail-row {
    padding-left: 16px;
    padding-right: 16px;
  }

  .mail-row {
    grid-template-columns: 1fr auto;
  }

  .sender {
    display: none;
  }
}
