:root {
  --navy:        #232c57;
  --navy-dark:   #1a2142;
  --page-bg:     #f4f6f9;
  --card-bg:     #ffffff;
  --ink:         #212529;
  --ink-muted:   #6c757d;
  --ink-soft:    #666666;
  --rule:        #dee2e6;
  --rule-soft:   rgba(0, 0, 0, .125);
  --input-rule:  #ced4da;
  --stripe:      rgba(0, 0, 0, .025);
  --hover:       rgba(35, 44, 87, .055);
  --danger:      #c0392b;
  --radius:      4px;
  --shadow:      0 0 1px rgba(0, 0, 0, .125), 0 1px 3px rgba(0, 0, 0, .2);
  --font: "Source Sans Pro", -apple-system, BlinkMacSystemFont, "Segoe UI",
          Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--page-bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; border: 0; }

a { color: var(--navy); }

/* ---------- masthead ---------- */

.masthead {
  background: var(--navy);
  border-bottom: 1px solid var(--rule);
  padding: .5rem 1rem;
}

.masthead__brand {
  display: inline-flex;
  align-items: center;
  gap: .75rem;
  color: #fff;
  font-size: 1.25rem;
  text-decoration: none;
  padding: .3125rem 0;
}

.masthead__brand:hover { color: #fff; text-decoration: none; }
.masthead__crest { width: 57px; height: auto; flex: none; }

/* ---------- shell ---------- */

.shell {
  flex: 1 0 auto;
  width: 100%;
  max-width: 1140px;
  margin: 0 auto;
  padding: 1rem;
}

.backlink {
  display: inline-flex;
  align-items: center;
  gap: .375rem;
  color: var(--navy);
  font-size: 1rem;
  text-decoration: none;
  margin-bottom: .75rem;
}

.backlink:hover { text-decoration: underline; }
.backlink svg { width: .6875rem; height: .6875rem; }

/* ---------- cards ---------- */

.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border-top: 3px solid var(--navy);
  margin-bottom: 1rem;
  overflow: hidden;
}

.card__header {
  padding: .75rem 1.25rem;
  border-bottom: 1px solid var(--rule-soft);
}

.card__title { margin: 0; font-size: 1.1rem; font-weight: 400; }

/* ---------- sign-in ---------- */

.login { max-width: 25rem; margin: 2rem auto 0; }
.login .card { border-top-width: 3px; }

.login__body { padding: 1.25rem; text-align: center; color: var(--ink-soft); }
.login__crest { width: 130px; height: auto; }
.login__msg { margin: .25rem 0 1.25rem; padding: 0 1.25rem; color: var(--ink-soft); }

.field { display: block; margin-bottom: 1rem; text-align: left; }

/* The English design labels its inputs with placeholder text only. That is
   kept exactly, so the label is present for screen readers and hidden
   visually rather than adding a control the English version does not have. */
.field__label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.field__wrap { display: flex; }

.field__input {
  flex: 1 1 auto;
  min-width: 0;
  height: 2.375rem;
  padding: .375rem .75rem;
  font: inherit;
  color: #495057;
  background: #fff;
  border: 1px solid var(--input-rule);
  border-right: 0;
  border-radius: var(--radius) 0 0 var(--radius);
}

.field__input::placeholder { color: #8a9099; }

.field__icon {
  display: flex;
  align-items: center;
  padding: 0 .75rem;
  color: #777;
  background: transparent;
  border: 1px solid var(--input-rule);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.field__icon svg { width: 1rem; height: 1rem; }

.login__actions { display: flex; justify-content: flex-end; }

.btn {
  display: inline-block;
  padding: .375rem 1rem;
  font: inherit;
  color: #fff;
  background: var(--navy);
  border: 1px solid var(--navy);
  border-radius: var(--radius);
  cursor: pointer;
}

.btn:hover { background: var(--navy-dark); border-color: var(--navy-dark); }

.alert {
  margin: 0 0 1rem;
  color: var(--danger);
  font-size: .9375rem;
}

.alert[hidden] { display: none; }

/* ---------- inbox ---------- */

.inbox__meta {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: .5rem;
  padding: .5rem 1.25rem;
  font-size: .9375rem;
  color: var(--ink-muted);
  border-bottom: 1px solid var(--rule-soft);
}

.inbox__meta--foot { border-bottom: 0; border-top: 1px solid var(--rule-soft); }

.pager { display: inline-flex; gap: .25rem; }

.pager span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  color: #adb5bd;
}

.pager svg { width: .625rem; height: .625rem; }

.inbox__table { width: 100%; border-collapse: collapse; }

.inbox__row { cursor: pointer; border-bottom: 1px solid var(--rule-soft); }
.inbox__row:nth-child(odd) { background: var(--stripe); }
.inbox__row:hover, .inbox__row:focus-within { background: var(--hover); }
.inbox__row:last-child { border-bottom: 0; }

.inbox__row td { padding: .625rem 1.25rem; vertical-align: middle; }

.inbox__sender { font-weight: 700; white-space: nowrap; }
.inbox__subject { font-weight: 700; }

.inbox__subject a { color: inherit; text-decoration: none; }
.inbox__subject a:hover { text-decoration: underline; }

.inbox__clip { width: 1.5rem; color: var(--ink-muted); }
.inbox__clip svg { width: .875rem; height: .875rem; }

.inbox__date {
  white-space: nowrap;
  color: var(--ink);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ---------- reading an email ---------- */

.mail__head { padding: .625rem 1.25rem; border-bottom: 1px solid var(--rule-soft); }

.mail__subject { margin: 0 0 .25rem; font-size: 1.25rem; font-weight: 400; }

.mail__from {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem 1rem;
  justify-content: space-between;
  margin: 0;
  font-size: 1rem;
  font-weight: 400;
  color: var(--ink);
}

.mail__date { color: var(--ink-muted); font-variant-numeric: tabular-nums; }

.mail__body { padding: .625rem 1.25rem; }
.mail__body p { margin: 0 0 1rem; }
.mail__body p:last-child { margin-bottom: 0; }
.mail__body .mail__sig { margin-bottom: 1rem; }
.mail__inline { margin: 1rem 0 0; }

/* ---------- attachment tiles ---------- */

.attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  list-style: none;
  margin: 0;
  padding: 1.25rem;
  border-top: 1px solid var(--rule-soft);
}

.attachment { width: 12.5rem; max-width: 100%; }

.attachment a {
  display: block;
  color: var(--ink);
  text-decoration: none;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
  height: 100%;
}

.attachment a:hover { border-color: var(--navy); }

.attachment__thumb {
  display: block;
  height: 8.75rem;
  overflow: hidden;
  background: #fff;
}

.attachment__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
}

.attachment__info {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .375rem;
  padding: .625rem .5rem;
  text-align: center;
  font-weight: 700;
  border-top: 1px solid var(--rule);
}

.attachment__info svg { width: .875rem; height: .875rem; flex: none; }

/* ---------- focus ---------- */

a:focus-visible,
button:focus-visible,
input:focus-visible,
.inbox__row:focus-visible {
  outline: 2px solid var(--navy);
  outline-offset: 2px;
}

.field__input:focus { outline: 2px solid var(--navy); outline-offset: -1px; }

/* ---------- phones ----------
   The English inbox is a four-column table that scrolls sideways on a
   phone. Here each row becomes a stacked block instead. */

@media (max-width: 47.9375em) {
  .shell { padding: .75rem; }

  .masthead__brand { font-size: 1.0625rem; gap: .5rem; }
  .masthead__crest { width: 40px; }

  .inbox__table, .inbox__table tbody { display: block; }
  .inbox__row { display: grid; grid-template-columns: 1fr auto; gap: 0 .5rem; padding: .75rem 1rem; }
  .inbox__row td { display: block; padding: 0; }
  .inbox__sender { grid-column: 1; font-size: .9375rem; color: var(--ink-muted); font-weight: 600; }
  .inbox__clip { grid-column: 2; grid-row: 1; text-align: right; width: auto; }
  .inbox__subject { grid-column: 1 / -1; }
  .inbox__date { grid-column: 1 / -1; text-align: left; font-size: .875rem; color: var(--ink-muted); }

  .mail__head, .mail__body, .attachments { padding-left: 1rem; padding-right: 1rem; }
  .mail__from { flex-direction: column; }
  .attachment { width: 100%; }
  .login { margin-top: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
