:root {
  --bg: #f2f5f9;
  --panel: #ffffff;
  --line: #dfe5ed;
  --line-strong: #c8d2df;
  --text: #1f2933;
  --muted: #6c7887;
  --brand: #148bc2;
  --brand-dark: #0d6f9e;
  --brand-soft: #e7f5fb;
  --shadow: 0 12px 35px rgb(30 52 77 / 10%);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
}

button,
input {
  font: inherit;
}

button:disabled {
  cursor: default;
}

.app-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 232px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  height: 100vh;
  flex-direction: column;
  background: #fbfcfe;
  border-right: 1px solid var(--line);
}

.brand {
  display: flex;
  min-height: 88px;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.brand-mark {
  display: grid;
  width: 52px;
  height: 52px;
  flex: none;
  place-items: center;
  color: #fff;
  background: linear-gradient(145deg, #23a0d4, #117aac);
  border-radius: 12px;
  box-shadow: 0 8px 18px rgb(18 139 194 / 24%);
}

.brand-mark svg {
  width: 34px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 21px;
  letter-spacing: -0.4px;
}

.brand div > span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.compose-button {
  display: flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 20px 18px 10px;
  color: #fff;
  background: var(--brand);
  border: 0;
  border-radius: 7px;
  font-weight: 800;
}

.compose-button span {
  font-size: 22px;
  line-height: 1;
}

.mailboxes {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px;
}

.mailbox {
  display: grid;
  min-height: 44px;
  grid-template-columns: 24px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  color: #45515f;
  background: transparent;
  border: 0;
  border-radius: 7px;
  text-align: left;
}

.mailbox strong {
  font-size: 14px;
}

.mailbox.active {
  color: var(--brand-dark);
  background: var(--brand-soft);
}

.account-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px;
  border-top: 1px solid var(--line);
}

.account-avatar,
.sender-avatar {
  display: grid;
  flex: none;
  place-items: center;
  color: #fff;
  background: var(--brand);
  border-radius: 50%;
  font-weight: 800;
}

.account-avatar {
  width: 38px;
  height: 38px;
}

.account-card strong,
.account-card small {
  display: block;
}

.account-card small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.workspace {
  min-width: 0;
}

.topbar {
  position: sticky;
  z-index: 10;
  top: 0;
  display: flex;
  min-height: 88px;
  align-items: center;
  justify-content: space-between;
  padding: 14px clamp(24px, 4vw, 58px);
  background: rgb(255 255 255 / 94%);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.topbar h1,
.topbar p {
  margin: 0;
}

.topbar h1 {
  margin-top: 2px;
  font-size: 24px;
  letter-spacing: -0.5px;
}

.eyebrow {
  color: var(--brand);
  font-size: 12px;
  font-weight: 850;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.topbar-actions button {
  width: 36px;
  height: 36px;
  color: var(--brand-dark);
  background: var(--brand-soft);
  border: 0;
  border-radius: 8px;
}

.mail-feed {
  width: min(1080px, calc(100% - 48px));
  margin: 28px auto 80px;
}

.mail-thread {
  overflow: hidden;
  margin-bottom: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.thread-header {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 15px 22px;
  background: #fafcfe;
  border-bottom: 1px solid var(--line);
}

.sender-avatar {
  width: 42px;
  height: 42px;
}

.thread-header strong,
.thread-header small {
  display: block;
}

.thread-header small,
.thread-header time {
  color: var(--muted);
  font-size: 12px;
}

.thread-header small {
  margin-top: 3px;
}

.thread-content {
  padding: 26px clamp(24px, 4vw, 48px) 38px;
}

.message + .message {
  margin-top: 34px;
}

.message.quoted {
  margin-left: 4px;
  padding-left: 18px;
  border-left: 4px solid #1b1f24;
}

.quote-label {
  margin: 0 0 10px;
  color: #242b33;
  font-size: 14px;
  letter-spacing: 1px;
}

.message-meta {
  margin: 0;
}

.message-meta > div {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  margin: 3px 0;
}

.message-meta dt,
.message-meta dd {
  margin: 0;
}

.message-meta dt {
  color: #394553;
  font-weight: 750;
}

.message-meta a {
  color: #075ee8;
  text-decoration: underline;
}

.message-body {
  margin-top: 26px;
  font-size: 16px;
  line-height: 1.72;
}

.message-body p {
  margin: 0;
  white-space: pre-wrap;
}

.attachment {
  display: flex;
  max-width: 680px;
  align-items: flex-start;
  gap: 10px;
  margin: 14px 0 0 48px;
  padding: 12px 14px;
  color: #35404c;
  background: #f5f8fb;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.attachment-icon {
  color: var(--brand);
  font-size: 20px;
}

.attachment strong,
.attachment span,
.attachment small {
  display: block;
}

.attachment span span {
  margin-top: 4px;
  font-weight: 700;
}

.attachment small {
  margin-top: 3px;
  color: var(--muted);
}

.attachment.expired {
  opacity: 0.7;
}

@media (max-width: 760px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    display: none;
  }

  .topbar {
    min-height: 72px;
    padding-inline: 18px;
  }

  .mail-feed {
    width: calc(100% - 24px);
    margin-top: 12px;
  }

  .thread-header {
    grid-template-columns: 38px 1fr;
    padding: 13px 16px;
  }

  .thread-header time {
    grid-column: 2;
  }

  .sender-avatar {
    width: 38px;
    height: 38px;
  }

  .thread-content {
    padding: 22px 16px 30px;
  }

  .message-meta > div {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .message-body {
    font-size: 15px;
  }

  .attachment {
    margin-left: 0;
  }
}
