.accounts-main {
  max-width: 1540px;
}

.accounts-header {
  align-items: flex-end;
  margin-bottom: 28px;
}

.account-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.add-account-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 44px;
  padding: 0 17px;
  border: 1px solid var(--blue);
  border-radius: 11px;
  color: #fff;
  font-size: var(--type-small);
  font-weight: 700;
  text-decoration: none;
  background: var(--blue);
  box-shadow: 0 9px 22px rgba(var(--brand-accent-rgb), 0.16);
}

.add-account-button:hover {
  background: var(--blue-dark);
}

.add-account-button:focus-visible {
  outline: 3px solid var(--brand-accent-hover);
  outline-offset: 2px;
}

.accounts-overview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 18px;
  padding: 27px 29px;
  border: 1px solid rgba(var(--brand-accent-rgb), 0.15);
  border-radius: 20px;
  background:
    radial-gradient(circle at 100% 0%, rgba(var(--brand-accent-rgb), 0.2), transparent 19rem),
    linear-gradient(120deg, #fff, var(--brand-paper));
  box-shadow: 0 12px 34px rgba(var(--brand-ink-rgb), 0.045);
}

.accounts-overview h2,
.account-directory-heading h2 {
  margin: 0;
  color: var(--ink);
  letter-spacing: -0.035em;
}

.accounts-overview h2 {
  max-width: 620px;
  font-size: clamp(1.45rem, 2.4vw, 2.1rem);
}

.accounts-overview > div > p:last-child {
  margin: 8px 0 0;
  color: var(--brand-muted);
  font-size: var(--type-small);
}

.account-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(84px, 1fr));
  gap: 9px;
  min-width: 420px;
  margin: 0;
}

.account-summary > div {
  padding: 13px 15px;
  border: 1px solid rgba(var(--brand-accent-rgb), 0.1);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.76);
}

.account-summary dt {
  color: var(--brand-muted);
  font-size: var(--type-caption);
}

.account-summary dd {
  margin: 6px 0 0;
  color: var(--ink);
  font-size: 1.45rem;
  font-weight: 700;
}

.account-summary .is-ready dd {
  color: #087f66;
}

.account-summary .is-pending dd {
  color: #936119;
}

.account-summary .needs-attention dd {
  color: #b23c2f;
}

.accounts-attention {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
  padding: 15px 17px;
  border: 1px solid rgba(191, 76, 60, 0.24);
  border-radius: 14px;
  color: #79372f;
  background: #fff6f3;
}

.accounts-attention > span {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  font-weight: 700;
  background: #ffe3dc;
}

.accounts-attention p {
  margin: 4px 0 0;
  font-size: var(--type-small);
}

.accounts-attention a {
  color: #9b3429;
  font-size: var(--type-small);
  font-weight: 700;
  text-underline-offset: 3px;
}

.account-directory {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 12px 34px rgba(var(--brand-ink-rgb), 0.045);
}

.account-directory-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 25px 27px 20px;
  border-bottom: 1px solid var(--line);
}

.account-directory-heading h2 {
  font-size: 1.25rem;
}

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

.account-directory-item {
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr) minmax(240px, 0.9fr) auto;
  align-items: center;
  gap: 18px;
  padding: 22px 27px;
  border-left: 3px solid var(--mint);
}

.account-directory-item + .account-directory-item {
  border-top: 1px solid var(--brand-paper);
}

.account-directory-item.is-pending {
  border-left-color: #e7a23d;
  background: linear-gradient(90deg, rgba(255, 248, 235, 0.62), #fff 30%);
}

.account-directory-item.needs-reconnect {
  border-left-color: #d85d4f;
  background: linear-gradient(90deg, rgba(255, 239, 235, 0.62), #fff 30%);
}

.provider-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid var(--brand-line);
  border-radius: 15px;
  color: var(--blue-dark);
  font-weight: 700;
  background: var(--brand-paper);
}

.provider-mark.outlook {
  color: #176bb4;
}

.provider-mark.yahoo {
  color: #6a2da8;
}

.account-identity {
  min-width: 0;
}

.account-identity h3 {
  margin: 0;
  color: var(--ink);
  font-size: 1rem;
}

.account-email {
  overflow: hidden;
  margin: 5px 0 0;
  color: var(--ink-soft);
  font-size: var(--type-small);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 11px;
}

.account-tag {
  display: inline-flex;
  padding: 5px 8px;
  border-radius: 999px;
  color: #397164;
  font-size: var(--type-small);
  font-weight: 700;
  background: #e9f7f3;
}

.account-metadata {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 18px;
  margin: 0;
}

.account-metadata div {
  min-width: 0;
}

.account-metadata dt {
  color: var(--brand-muted);
  font-size: var(--type-caption);
}

.account-metadata dd {
  overflow: hidden;
  margin: 4px 0 0;
  color: var(--brand-muted);
  font-size: var(--type-small);
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-control {
  display: grid;
  justify-items: end;
  gap: 12px;
  min-width: 144px;
}

.account-health-reason {
  max-width: 190px;
  margin: 0;
  color: var(--brand-muted);
  font-size: var(--type-small);
  line-height: 1.45;
  text-align: right;
}

.health-badge {
  display: inline-flex;
  padding: 6px 9px;
  border-radius: 999px;
  color: #087f66;
  font-size: var(--type-caption);
  font-weight: 700;
  background: #e5f7f1;
}

.health-badge.pending {
  color: #8b5b14;
  background: #fff1d8;
}

.health-badge.reconnect-required {
  color: #9b3429;
  background: #ffe5df;
}

.manage-connection-link {
  color: var(--blue-dark);
  font-size: var(--type-small);
  font-weight: 700;
  text-underline-offset: 3px;
}

.accounts-empty {
  display: flex;
  align-items: center;
  gap: 18px;
  margin: 28px;
  padding: 34px;
  border: 1px dashed var(--brand-line);
  border-radius: 17px;
  background: var(--brand-paper);
}

.accounts-empty > span {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border-radius: 15px;
  color: var(--blue);
  font-size: 1.3rem;
  background: rgba(var(--brand-accent-rgb), 0.08);
}

.accounts-empty h3 {
  margin: 0;
  color: var(--ink);
}

.accounts-empty p {
  margin: 6px 0 12px;
  color: var(--ink-soft);
  font-size: var(--type-small);
}

.accounts-empty a {
  color: var(--blue-dark);
  font-size: var(--type-small);
  font-weight: 700;
}

.accounts-footer {
  margin-top: 22px;
}

@media (max-width: 980px) {
  .accounts-overview {
    align-items: stretch;
    flex-direction: column;
  }

  .account-summary {
    min-width: 0;
  }

  .account-directory-item {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .account-metadata {
    grid-column: 2 / -1;
  }
}

@media (max-width: 760px) {
  .accounts-header {
    align-items: stretch;
  }

  .account-header-actions {
    width: 100%;
  }

  .account-header-actions > * {
    flex: 1;
  }

  .account-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .accounts-attention {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .accounts-attention a {
    grid-column: 2;
  }

  .account-directory-item {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .account-metadata,
  .account-control {
    grid-column: 1 / -1;
  }

  .account-control {
    justify-items: start;
  }
}

@media (prefers-reduced-motion: reduce) {
  .add-account-button,
  .manage-connection-link,
  .accounts-attention a {
    transition: none;
  }
}
