:root {
  --bg: #f4f7f6;
  --panel: #ffffff;
  --panel-strong: #eef5f3;
  --text: #102422;
  --muted: #64716f;
  --border: #d9e4e1;
  --accent: #006c67;
  --accent-strong: #004f4b;
  --accent-soft: #d8f2ef;
  --danger: #9c2f2f;
  --shadow: 0 18px 42px rgba(16, 36, 34, 0.11);
}

body.dark {
  --bg: #111817;
  --panel: #182321;
  --panel-strong: #20302d;
  --text: #eef8f6;
  --muted: #a9b8b5;
  --border: #30433f;
  --accent: #34c7bd;
  --accent-strong: #7ee6df;
  --accent-soft: #163b38;
  --danger: #ff8f8f;
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.26);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Satoshi, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  transition: background-color 160ms ease, color 160ms ease;
}

button {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.app-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 44px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 7vw, 4.25rem);
  line-height: 0.95;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 6px;
  font-size: 1rem;
  letter-spacing: 0;
}

.icon-button {
  min-width: 58px;
  height: 44px;
  padding: 0 12px;
  display: grid;
  place-items: center;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  font-size: 0.86rem;
}

.address-section,
.inbox-panel,
.message-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.address-section {
  padding: 22px;
  margin-bottom: 18px;
}

.address-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

#statusText,
#messageFrom {
  margin-bottom: 0;
  color: var(--muted);
}

.timer {
  min-width: 78px;
  padding: 8px 12px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  border-radius: 8px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.address-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  margin: 18px 0;
  padding: 10px;
  background: var(--panel-strong);
  border: 1px solid var(--border);
  border-radius: 8px;
}

#emailAddress {
  min-width: 0;
  overflow-wrap: anywhere;
  padding: 8px;
  font-size: clamp(1.05rem, 3.5vw, 1.55rem);
  font-weight: 700;
}

#copyButton,
.actions button {
  min-height: 42px;
  padding: 0 16px;
}

#copyButton,
.actions button:first-child {
  background: var(--accent);
  color: #ffffff;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.actions button {
  background: var(--panel-strong);
  color: var(--text);
  border: 1px solid var(--border);
}

#deleteButton {
  color: var(--danger);
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(280px, 390px) minmax(0, 1fr);
  gap: 18px;
}

.inbox-panel,
.message-panel {
  min-height: 470px;
}

.panel-header,
.message-meta {
  padding: 18px;
  border-bottom: 1px solid var(--border);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

#messageCount {
  display: grid;
  min-width: 30px;
  height: 30px;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent-strong);
  border-radius: 999px;
  font-weight: 700;
}

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

.message-item {
  width: 100%;
  display: block;
  padding: 14px 18px;
  background: transparent;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  text-align: left;
}

.message-item:hover,
.message-item.active {
  background: var(--panel-strong);
}

.message-item.highlight {
  animation: highlight 1.2s ease;
}

.message-sender,
.message-subject,
.message-time {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-sender {
  color: var(--accent-strong);
  font-size: 0.86rem;
  font-weight: 700;
}

.message-subject {
  margin: 4px 0;
  font-size: 0.98rem;
}

.message-time {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 500;
}

.empty-state {
  min-height: 330px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  color: var(--muted);
}

.empty-icon {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent-strong);
  border-radius: 999px;
  font-size: 1.8rem;
  font-weight: 700;
  animation: float 2.2s ease-in-out infinite;
}

.message-panel {
  overflow: hidden;
}

#messageFrame {
  width: 100%;
  height: 390px;
  display: block;
  background: #ffffff;
  border: 0;
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-7px);
  }
}

@keyframes highlight {
  0% {
    background: rgba(52, 199, 189, 0.35);
  }
  100% {
    background: transparent;
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 20px, 520px);
    padding-top: 18px;
  }

  .address-section {
    padding: 16px;
  }

  .address-header,
  .topbar {
    align-items: center;
  }

  .address-box {
    grid-template-columns: 1fr;
  }

  #copyButton,
  .actions button {
    width: 100%;
  }

  .content-grid {
    grid-template-columns: 1fr;
  }

  .inbox-panel,
  .message-panel {
    min-height: 330px;
  }

  #messageFrame {
    height: 360px;
  }
}
