:root {
  color-scheme: light;
  --background: #f6f7f8;
  --surface: #ffffff;
  --citi-blue: #003b70;
  --citi-blue-soft: #eaf2f8;
  --citi-red: #d9261c;
  --ink: #142b43;
  --muted: #687786;
  --line: #dce3e9;
  --shadow: 0 18px 46px rgb(0 59 112 / 9%);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--background);
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--background);
}

button,
input {
  font: inherit;
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

a {
  color: var(--citi-blue);
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 50;
  padding: 0.7rem 1rem;
  color: var(--surface);
  background: var(--citi-blue);
  border-radius: 0.65rem;
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: translateY(0);
}

.masthead,
.page-shell {
  width: min(1120px, 100%);
  margin-inline: auto;
}

.masthead {
  display: grid;
  justify-items: center;
  padding: max(clamp(3.5rem, 12vh, 7rem), env(safe-area-inset-top))
    max(1.25rem, env(safe-area-inset-right)) 2rem max(1.25rem, env(safe-area-inset-left));
}

.brand {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
  justify-content: center;
  color: var(--citi-blue);
  text-decoration: none;
}

.brand-logo {
  display: block;
  width: clamp(4.75rem, 7vw, 6.25rem);
  height: auto;
}

h1 {
  margin: 0;
  font-size: clamp(1.15rem, 1.8vw, 1.45rem);
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.mail-search {
  display: flex;
  gap: 0.7rem;
  align-items: center;
  margin-top: 2.25rem;
}

.range-fields {
  position: relative;
  display: flex;
  gap: 0.6rem;
  align-items: center;
}

.date-field {
  display: grid;
  gap: 0.35rem;
}

.range-separator {
  color: var(--muted);
  font-size: 0.82rem;
}

.button {
  display: inline-flex;
  gap: 0.55rem;
  align-items: center;
  justify-content: center;
  min-height: 2.9rem;
  padding: 0.6rem 1rem;
  font-size: 0.87rem;
  font-weight: 760;
  border: 1px solid transparent;
  border-radius: 0.75rem;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.button-date {
  min-width: 11.4rem;
  color: var(--citi-blue);
  background: var(--surface);
  border-color: var(--line);
  box-shadow: 0 5px 18px rgb(0 59 112 / 5%);
}

.calendar-icon {
  width: 1.1rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.button-primary {
  min-width: 5.5rem;
  color: var(--surface);
  background: var(--citi-blue);
}

.button-summary {
  flex: 0 0 auto;
  color: var(--surface);
  background: var(--citi-blue);
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgb(0 59 112 / 12%);
}

.button:focus-visible,
a:focus-visible,
.calendar-nav:focus-visible,
.back-button:focus-visible,
.calendar-grid button:focus-visible {
  outline: 3px solid var(--citi-red);
  outline-offset: 3px;
}

.calendar-panel {
  position: absolute;
  top: calc(100% + 0.55rem);
  left: 0;
  z-index: 20;
  width: min(21rem, calc(100vw - 2rem));
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 1rem;
  box-shadow: var(--shadow);
}

.calendar-header {
  display: grid;
  grid-template-columns: 2.5rem 1fr 2.5rem;
  align-items: center;
  margin-bottom: 0.8rem;
  text-align: center;
}

.calendar-nav {
  width: 2.5rem;
  height: 2.5rem;
  color: var(--citi-blue);
  font-size: 1.5rem;
  background: transparent;
  border: 0;
  border-radius: 0.6rem;
  cursor: pointer;
}

.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.25rem;
}

.calendar-weekdays {
  margin-bottom: 0.3rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 750;
  text-align: center;
}

.calendar-grid button,
.calendar-spacer {
  aspect-ratio: 1;
}

.calendar-grid button {
  color: var(--ink);
  background: transparent;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
}

.calendar-grid button:hover,
.calendar-grid button.is-in-range {
  background: var(--citi-blue-soft);
}

.calendar-grid button.is-start,
.calendar-grid button.is-end {
  color: var(--surface);
  font-weight: 800;
  background: var(--citi-blue);
}

.calendar-grid button.is-today:not(.is-start, .is-end) {
  box-shadow: inset 0 0 0 1px var(--citi-red);
}

.status {
  min-height: 1.3rem;
  margin: 0.8rem 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
}

.status[data-state="error"] {
  color: var(--citi-red);
}

.status[data-state="success"] {
  color: #26734d;
}

.page-shell {
  min-height: 24rem;
  padding: 1rem max(1.25rem, env(safe-area-inset-right)) max(4rem, env(safe-area-inset-bottom))
    max(1.25rem, env(safe-area-inset-left));
}

.empty-state {
  padding: 4rem 1rem;
  text-align: center;
}

.empty-state h2 {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  font-weight: 600;
}

.section-heading,
.document-heading {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
}

.section-heading {
  margin-bottom: 1rem;
}

.section-heading.compact {
  margin-bottom: 0.75rem;
}

.section-heading h2,
.section-heading h3,
.document-heading h3 {
  margin: 0.12rem 0 0;
}

.eyebrow,
.attachment-type {
  margin: 0;
  color: var(--citi-red);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.result-count {
  padding: 0.4rem 0.7rem;
  color: var(--citi-blue);
  font-size: 0.78rem;
  font-weight: 750;
  background: var(--citi-blue-soft);
  border-radius: 999px;
}

.table-shell {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 1rem;
  box-shadow: var(--shadow);
}

.mail-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.mail-table th,
.mail-table td {
  padding: 1rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}

.mail-table th {
  color: var(--muted);
  font-size: 0.73rem;
  letter-spacing: 0.06em;
  background: #fafbfc;
}

.mail-table th:first-child {
  width: 18%;
}

.mail-table th:nth-child(2) {
  width: 36%;
}

.mail-table th:nth-child(3) {
  width: 15%;
}

.mail-table tr:last-child td {
  border-bottom: 0;
}

.mail-table a {
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1.5;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

.result-attachments {
  display: grid;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.back-button {
  margin-bottom: 1rem;
  padding: 0.6rem 0;
  color: var(--citi-blue);
  font-weight: 750;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.detail-card {
  padding: clamp(1.3rem, 4vw, 2.4rem);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 1.2rem;
  box-shadow: var(--shadow);
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 1rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.detail-card > h2 {
  margin: 0.6rem 0 1.5rem;
  font-size: clamp(1.4rem, 3vw, 2rem);
  line-height: 1.35;
}

.document-card {
  padding: 1.2rem;
  background: #fbfcfd;
  border: 1px solid var(--line);
  border-radius: 0.9rem;
}

.message-content {
  max-height: 34rem;
  margin: 1rem 0 0;
  padding: 0.75rem;
  overflow: auto;
  color: #405365;
  font-size: 0.88rem;
  line-height: 1.55;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0.65rem;
  word-break: break-word;
}

.message-content p {
  margin: 0;
  padding: 0.24rem 0;
}

.message-content p + p {
  border-top: 1px solid #edf1f4;
}

.message-links {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.message-links h4 {
  margin: 0 0 0.65rem;
  font-size: 0.95rem;
}

.message-links ul {
  display: grid;
  gap: 0.45rem;
  margin: 0;
  padding-left: 1.2rem;
}

.message-links a,
.message-content a {
  overflow-wrap: anywhere;
  font-weight: 700;
}

.attachments-section {
  margin-top: 1.5rem;
}

.attachment-list {
  display: grid;
  gap: 0.75rem;
}

.attachment-download {
  display: inline-block;
  margin-top: 0.25rem;
  font-size: 0.92rem;
  font-weight: 750;
}

.attachment-empty {
  color: var(--muted);
}

.summary-output {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.summary-work-link {
  width: fit-content;
  margin-top: 0.25rem;
  text-decoration: none;
}

.summary-task-id {
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.82rem;
}

.summary-expiry,
.summary-plugin-help {
  color: var(--muted);
  font-size: 0.88rem;
}

.summary-plugin-help a {
  display: block;
  margin-top: 0.35rem;
  overflow-wrap: anywhere;
}

.summary-news-item {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem 1.5rem;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0.75rem;
}

.summary-news-item > h4 {
  grid-column: 1 / -1;
  color: var(--citi-blue);
}

.summary-output section + section {
  padding-left: 1.5rem;
  border-left: 1px solid var(--line);
}

.language-label {
  margin: 0 0 0.6rem;
  color: var(--citi-red);
  font-size: 0.67rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.summary-output h4,
.summary-output h5 {
  margin: 0;
  font-size: 1.15rem;
  line-height: 1.4;
}

.summary-output h5 {
  font-size: 1rem;
}

.summary-loading,
.summary-empty,
.summary-error {
  margin: 0;
  padding: 0.9rem 1rem;
  background: #f3f7fa;
  border-radius: 0.65rem;
}

.summary-error {
  color: #9f2019;
  background: #fff2f0;
}

.summary-billing-link {
  display: inline-block;
  margin-top: 0.45rem;
  font-weight: 750;
}

.summary-output section > p:last-child {
  margin: 0.7rem 0 0;
  color: #48596a;
  line-height: 1.7;
}

[hidden] {
  display: none !important;
}

@media (max-width: 760px) {
  .mail-search,
  .range-fields {
    width: 100%;
  }

  .mail-search {
    display: grid;
  }

  .range-fields {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
  }

  .button-date {
    width: 100%;
    min-width: 0;
  }

  .table-shell {
    overflow: visible;
    background: transparent;
    border: 0;
    box-shadow: none;
  }

  .mail-table,
  .mail-table tbody,
  .mail-table tr,
  .mail-table td {
    display: block;
    width: 100%;
  }

  .mail-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .mail-table tr {
    margin-bottom: 0.8rem;
    padding: 0.5rem 1rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 0.9rem;
    box-shadow: var(--shadow);
  }

  .mail-table td {
    display: grid;
    grid-template-columns: 5rem 1fr;
    gap: 0.75rem;
    padding: 0.65rem 0;
  }

  .mail-table td::before {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 750;
    content: attr(data-label);
  }
}

@media (max-width: 560px) {
  .masthead {
    padding-top: max(2.5rem, env(safe-area-inset-top));
  }

  .brand-logo {
    width: 4.5rem;
  }

  h1 {
    font-size: 1.05rem;
  }

  .range-fields {
    grid-template-columns: 1fr;
  }

  .range-separator {
    display: none;
  }

  .mail-search .button-primary,
  .button-summary {
    width: 100%;
    min-height: 3rem;
  }

  .calendar-panel {
    width: 100%;
  }

  .document-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .summary-output {
    grid-template-columns: 1fr;
  }

  .summary-news-item {
    grid-template-columns: 1fr;
  }

  .summary-news-item > h4 {
    grid-column: 1;
  }

  .summary-output section + section {
    padding-top: 1rem;
    padding-left: 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }
}
