/* AEX.Mail: the simulated shared-inbox client (automation 08). Gmail look by default,
   Outlook look with [data-skin="outlook"]. The --ml-* palette is defined only on .ia-mail
   (and on the hero's own roots in ia-hero.css). Every rule is scoped under .ia-mail. */

.ia-mail {
  --ml-app: #f6f8fc;
  --ml-list: #ffffff;
  --ml-ink: #1f1f1f;
  --ml-muted: #5f6368;
  --ml-line: #eceff3;
  --ml-sel: #eaf1fb;
  --ml-unread: #0b57d0;
  --ml-accent: #0b57d0;
  --ml-compose-bg: #c2e7ff;
  --ml-compose-ink: #001d35;
  --ml-search: #e9eef6;
  --ml-active: #d3e3fd;
  --ml-drawer: #f8fafd;
  --ml-chip-r: 0.3em;
  --ml-ok: #1e7b45;
  --ml-ai-bg: #fdf8ec;
  --ml-ai-line: #eadfbe;
  --ml-ai-ink: #6d5208;
  --ml-ai-muted: #8a7a52;
  --ml-ai-icon: #a37c0a;
  --ml-hit: rgba(212, 172, 53, 0.38);
  --ml-bar: #1c5cab;
  --ml-top: #f6f8fc;
  --ml-top-ink: #444746;
  --ml-dim: #f2f4f7;

  position: relative;
  display: grid;
  grid-template-rows: 3.3em minmax(0, 1fr);
  height: 100%;
  min-height: 0;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.35;
  color: var(--ml-ink);
  background: var(--ml-app);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2.4em 4.8em -1.6em rgba(0, 0, 0, 0.65);
}

.ia-mail[data-skin="outlook"] {
  --ml-app: #f5f5f5;
  --ml-list: #ffffff;
  --ml-ink: #242424;
  --ml-muted: #616161;
  --ml-line: #e0e0e0;
  --ml-sel: #ebf3fc;
  --ml-unread: #0f6cbd;
  --ml-accent: #0f6cbd;
  --ml-compose-bg: #0f6cbd;
  --ml-compose-ink: #ffffff;
  --ml-search: rgba(255, 255, 255, 0.94);
  --ml-active: #e6f0fa;
  --ml-drawer: #fafafa;
  --ml-chip-r: 0.15em;
  --ml-top: #0f6cbd;
  --ml-top-ink: #ffffff;
  --ml-dim: #f0f0f0;
}

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

.ia-mail .ia-ml-ic {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 1.1em;
  height: 1.1em;
}

.ia-mail .ia-ml-ic svg,
.ia-mail svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* ---------- Top bar ---------- */

.ia-mail .ia-ml-top {
  display: flex;
  align-items: center;
  gap: 0.8em;
  padding: 0 1em;
  background: var(--ml-top);
  color: var(--ml-top-ink);
  min-width: 0;
}

.ia-mail .ia-ml-menu {
  flex: none;
  width: 1.2em;
  height: 1.2em;
  color: var(--ml-muted);
}

.ia-mail[data-skin="outlook"] .ia-ml-menu {
  color: #ffffff;
}

.ia-mail .ia-ml-brand {
  flex: none;
  font-size: 0.95em;
  font-weight: 500;
  color: var(--ml-top-ink);
}

.ia-mail[data-skin="outlook"] .ia-ml-brand {
  font-weight: 600;
}

.ia-mail .ia-ml-search {
  display: flex;
  align-items: center;
  gap: 0.5em;
  flex: 1 1 auto;
  min-width: 0;
  height: 2.3em;
  padding: 0 0.9em;
  border-radius: 999px;
  background: var(--ml-search);
  color: var(--ml-muted);
  font-size: 0.85em;
  white-space: nowrap;
  overflow: hidden;
}

.ia-mail .ia-ml-search svg {
  flex: none;
  width: 1.1em;
  height: 1.1em;
}

.ia-mail[data-skin="outlook"] .ia-ml-search {
  height: 2.1em;
  border-radius: 0.3em;
  color: #616161;
}

.ia-mail .ia-ml-avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 1.9em;
  height: 1.9em;
  border-radius: 50%;
  background: var(--ml-bar);
  color: #ffffff;
  font-size: 0.8em;
  font-weight: 600;
}

.ia-mail[data-skin="outlook"] .ia-ml-avatar {
  background: #ffffff;
  color: #0f6cbd;
}

/* ---------- Body: rail + list panel ---------- */

.ia-mail .ia-ml-body {
  display: grid;
  grid-template-columns: 9.6em minmax(0, 1fr);
  min-height: 0;
  background: var(--ml-app);
}

.ia-mail .ia-ml-rail {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 0.7em 0.4em 0.7em 0.6em;
  overflow: hidden;
}

.ia-mail .ia-ml-compose {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  align-self: flex-start;
  padding: 0.6em 1em;
  margin-bottom: 0.8em;
  border-radius: 1em;
  background: var(--ml-compose-bg);
  color: var(--ml-compose-ink);
  font-size: 0.9em;
  font-weight: 600;
  white-space: nowrap;
}

.ia-mail .ia-ml-compose svg {
  width: 1.1em;
  height: 1.1em;
  flex: none;
}

.ia-mail[data-skin="outlook"] .ia-ml-compose {
  border-radius: 0.3em;
  padding: 0.55em 0.9em;
}

.ia-mail .ia-ml-navitem {
  display: flex;
  align-items: center;
  gap: 0.7em;
  padding: 0.42em 0.8em;
  border-radius: 0 999px 999px 0;
  font-size: 0.92em;
  font-weight: 600;
  color: var(--ml-ink);
  white-space: nowrap;
}

.ia-mail .ia-ml-navitem svg {
  width: 1.05em;
  height: 1.05em;
  flex: none;
}

.ia-mail .ia-ml-navitem.is-active {
  background: var(--ml-active);
}

.ia-mail[data-skin="outlook"] .ia-ml-navitem {
  position: relative;
  border-radius: 0.3em;
  font-weight: 500;
}

.ia-mail[data-skin="outlook"] .ia-ml-navitem.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.25em;
  bottom: 0.25em;
  width: 3px;
  border-radius: 2px;
  background: #0f6cbd;
}

.ia-mail .ia-ml-railhead {
  margin: 1em 0.8em 0.35em;
  font-size: 0.66em;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ml-muted);
  white-space: nowrap;
}

.ia-mail .ia-ml-label {
  display: grid;
  grid-template-columns: 0.55em minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.5em;
  padding: 0.32em 0.6em 0.32em 0.8em;
  border-radius: 0 999px 999px 0;
  font-size: 0.8em;
  transition: background-color 0.3s, color 0.3s;
}

.ia-mail .ia-ml-mark {
  width: 0.55em;
  height: 0.55em;
  border-radius: 50%;
}

.ia-mail[data-skin="outlook"] .ia-ml-mark {
  border-radius: 0.1em;
}

.ia-mail .ia-ml-lname {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ml-ink);
}

.ia-mail .ia-ml-count {
  font-size: 0.9em;
  font-variant-numeric: tabular-nums;
  color: var(--ml-muted);
  transition: color 0.3s;
}

.ia-mail .ia-ml-label.is-bump {
  transition: background-color 0.3s, color 0.3s;
}

.ia-mail .ia-ml-label.is-bump .ia-ml-count {
  font-weight: 600;
}

/* Count change: the row takes its category tint for a moment (colours set inline per category) */
.ia-mail .ia-ml-label.is-bump {
  background: var(--ml-bump-bg, var(--ml-active));
}

.ia-mail .ia-ml-list-wrap {
  min-height: 0;
}

/* The list panel */
.ia-mail .ia-ml-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  margin-right: 0.5em;
  margin-top: 0;
  background: var(--ml-list);
  border-radius: 1em 1em 0 0;
  overflow: hidden;
}

.ia-mail[data-skin="outlook"] .ia-ml-panel {
  margin-right: 0;
  border-radius: 0;
  border-left: 1px solid var(--ml-line);
}

.ia-mail .ia-ml-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8em;
  height: 2.6em;
  padding: 0 1em;
  border-bottom: 1px solid var(--ml-line);
  min-width: 0;
}

.ia-mail .ia-ml-tabs {
  display: flex;
  align-items: stretch;
  gap: 1.2em;
  height: 100%;
}

.ia-mail .ia-ml-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  font-size: 0.86em;
  font-weight: 600;
  color: var(--ml-accent);
}

.ia-mail .ia-ml-tab--other {
  color: var(--ml-muted);
  font-weight: 500;
}

.ia-mail .ia-ml-tab.is-on::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--ml-accent);
}

.ia-mail .ia-ml-mailbox {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.72em;
  color: var(--ml-muted);
}

.ia-mail .ia-ml-list {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

/* ---------- Rows: grid-rows trick for every height change ---------- */

.ia-mail .ia-ml-row {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.45s var(--ease-out), opacity 0.45s var(--ease-out);
  opacity: 0;
}

.ia-mail .ia-ml-row.is-in {
  grid-template-rows: 1fr;
  opacity: 1;
}

.ia-mail .ia-ml-row.is-gone {
  grid-template-rows: 0fr;
  opacity: 0;
}

.ia-mail .ia-ml-row.is-dim .ia-ml-rowin:not(.is-selected) {
  background: var(--ml-dim);
}

.ia-mail .ia-ml-row.is-dim .ia-ml-from,
.ia-mail .ia-ml-row.is-dim .ia-ml-subj,
.ia-mail .ia-ml-row.is-dim .ia-ml-time {
  color: var(--ml-muted);
}

.ia-mail .ia-ml-row.is-dim .ia-ml-chip {
  color: #4f5459 !important;
}

.ia-mail .ia-ml-rowin {
  position: relative;
  min-height: 0;
  overflow: hidden;
  padding: 0.62em 1em 0.62em 0.8em;
  border-bottom: 1px solid var(--ml-line);
  cursor: default;
  transition: background-color 0.3s;
}

.ia-mail .ia-ml-rowin.is-selected {
  background: var(--ml-sel);
}

.ia-mail[data-skin="outlook"] .ia-ml-rowin.is-selected {
  box-shadow: inset 3px 0 #0f6cbd;
}

.ia-mail .ia-ml-rowin.is-urgent {
  box-shadow: inset 3px 0 #d93025;
}

.ia-mail .ia-ml-rowin.is-urgent.is-selected {
  background: var(--ml-sel);
}

.ia-mail .ia-ml-rowin.is-flash {
  animation: ia-ml-flash 1.2s ease-out both;
}

/* Line 1: dot, from, right side (attach, replied, assignee, time) */
.ia-mail .ia-ml-l1 {
  display: grid;
  grid-template-columns: 0.55em minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 0.6em;
  min-width: 0;
}

.ia-mail .ia-ml-dot {
  width: 0.45em;
  height: 0.45em;
  border-radius: 50%;
  background: var(--ml-unread);
}

.ia-mail .ia-ml-from {
  min-width: 0;
  font-size: 0.92em;
  font-weight: 700;
  color: var(--ml-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ia-mail .ia-ml-right {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  white-space: nowrap;
}

.ia-mail .ia-ml-time {
  font-size: max(0.76em, 10.5px);
  color: var(--ml-muted);
  font-variant-numeric: tabular-nums;
}

.ia-mail .ia-ml-attach-ic {
  display: inline-grid;
  width: 0.95em;
  height: 0.95em;
  color: var(--ml-muted);
}

.ia-mail .ia-ml-attach-ic svg {
  width: 100%;
  height: 100%;
}

.ia-mail .ia-ml-assignee {
  display: inline-grid;
  place-items: center;
  width: 1.55em;
  height: 1.55em;
  border-radius: 50%;
  background: #e8eaed;
  color: #3c4043;
  font-size: 0.68em;
  font-weight: 600;
}

.ia-mail[data-skin="outlook"] .ia-ml-assignee {
  background: #edebe9;
}

.ia-mail .ia-ml-replied {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  font-size: 0.72em;
  font-weight: 600;
  color: var(--ml-ok);
  white-space: nowrap;
}

.ia-mail .ia-ml-replied svg {
  width: 1em;
  height: 1em;
  flex: none;
}

.ia-mail .ia-ml-chips > .ia-ml-replied {
  margin-right: 0.5em;
}

/* Line 2: chips, then subject and snippet on one line */
.ia-mail .ia-ml-l2 {
  display: flex;
  align-items: center;
  min-width: 0;
  margin-left: 1.15em;
  margin-top: 0.15em;
  font-size: 0.86em;
  white-space: nowrap;
  overflow: hidden;
}

.ia-mail .ia-ml-chips {
  display: inline-flex;
  align-items: center;
  flex: none;
}

.ia-mail .ia-ml-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  margin-right: 0.4em;
  padding: 0.14em 0.55em;
  border-radius: var(--ml-chip-r);
  font-size: max(0.8em, 10.5px);
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}

.ia-mail .ia-ml-chip--urgent {
  background: #d93025;
  color: #ffffff;
}

.ia-mail .ia-ml-chip--urgent svg {
  width: 0.95em;
  height: 0.95em;
}

.ia-mail .ia-ml-chip.is-pop {
  animation: ia-ml-pop 0.35s var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 60ms);
}

.ia-mail .ia-ml-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ia-mail .ia-ml-subj {
  color: var(--ml-ink);
}

.ia-mail .ia-ml-snip {
  color: var(--ml-muted);
}

/* Reading drawer */
.ia-mail .ia-ml-drawer {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.45s var(--ease-out);
}

.ia-mail .ia-ml-drawer.is-open {
  grid-template-rows: 1fr;
}

.ia-mail .ia-ml-drawerin {
  min-height: 0;
  overflow: hidden;
  margin: 0.5em 0 0.15em 1.15em;
  padding: 0;
}

.ia-mail .ia-ml-drawer.is-open .ia-ml-drawerin {
  padding: 0.6em 0.75em;
  background: var(--ml-drawer);
  border: 1px solid var(--ml-line);
  border-radius: 0.6em;
}

.ia-mail .ia-ml-readtag {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  float: right;
  margin: 0 0 0.3em 0.6em;
  font-size: 0.68em;
  font-weight: 600;
  color: var(--ml-ai-ink);
}

.ia-mail .ia-ml-readtag svg {
  width: 0.95em;
  height: 0.95em;
  color: var(--ml-ai-icon);
}

.ia-mail .ia-ml-body-text {
  margin: 0;
  font-size: 0.84em;
  line-height: 1.5;
  color: #3c4043;
  white-space: normal;
}

.ia-mail .ia-ml-sig {
  background-image: linear-gradient(transparent 58%, var(--ml-hit) 58%);
  background-size: 0% 100%;
  background-repeat: no-repeat;
  transition: background-size 0.35s var(--ease-out);
}

.ia-mail .ia-ml-sig.is-hit {
  background-size: 100% 100%;
}

.ia-mail .ia-ml-attach {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  margin-top: 0.45em;
  padding: 0.2em 0.55em;
  border: 1px solid var(--ml-line);
  border-radius: 0.4em;
  background: #ffffff;
  font-size: 0.74em;
  color: var(--ml-ink);
}

.ia-mail .ia-ml-attach svg {
  width: 1em;
  height: 1em;
  color: var(--ml-muted);
  flex: none;
}

.ia-mail .ia-ml-attach.is-hit {
  outline: 2px solid var(--ml-hit);
}

/* Scan line: a gold sweep across the top edge while the row is read */
.ia-mail .ia-ml-scan {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 2px;
  background: var(--accent);
  transform: translateX(-100%);
  pointer-events: none;
  display: none;
}

.ia-mail .ia-ml-scan.is-run {
  display: block;
  animation: ia-ml-scan 0.65s var(--ease-out) both;
}

/* Tombstone: one grey line (the full row collapses behind it) */
.ia-mail .ia-ml-tombwrap {
  display: grid;
  grid-template-rows: 1fr;
}

.ia-mail .ia-ml-tomb {
  display: flex;
  align-items: center;
  gap: 0.5em;
  height: 2.2em;
  padding: 0 1em 0 2.15em;
  border-bottom: 1px solid var(--ml-line);
  font-size: 0.76em;
  font-style: italic;
  color: var(--ml-muted);
  white-space: nowrap;
  overflow: hidden;
}

.ia-mail .ia-ml-tomb svg {
  width: 1.1em;
  height: 1.1em;
  flex: none;
}

.ia-mail .ia-ml-tomb-t {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ia-mail .ia-ml-tomb-dot {
  flex: none;
  width: 0.5em;
  height: 0.5em;
  margin-left: auto;
  border-radius: 50%;
}

/* ---------- Flying dot (label moves from the chip to the rail) ---------- */

.ia-mail .ia-ml-fly {
  position: absolute;
  z-index: 4;
  width: 0.5em;
  height: 0.5em;
  margin: -0.25em 0 0 -0.25em;
  border-radius: 50%;
  pointer-events: none;
  transition: transform 0.55s var(--ease-out);
  font-size: 15px;
}

.ia-mail .ia-ml-fly {
  width: 6px;
  height: 6px;
  margin: -3px 0 0 -3px;
}

/* ---------- Small screens ---------- */

@media (max-width: 600px) {
  .ia-mail {
    font-size: 14px;
  }

  .ia-mail .ia-ml-body {
    grid-template-columns: 3.2em minmax(0, 1fr);
  }

  .ia-mail .ia-ml-rail {
    align-items: center;
    padding: 0.7em 0.3em;
  }

  .ia-mail .ia-ml-compose span,
  .ia-mail .ia-ml-navname,
  .ia-mail .ia-ml-railhead,
  .ia-mail .ia-ml-lname {
    display: none;
  }

  .ia-mail .ia-ml-compose {
    padding: 0.55em;
    border-radius: 50%;
  }

  .ia-mail .ia-ml-navitem {
    padding: 0.42em 0.5em;
    border-radius: 0.3em;
  }

  .ia-mail .ia-ml-label {
    grid-template-columns: 0.55em auto;
    justify-content: center;
    padding: 0.32em 0.4em;
    gap: 0.35em;
  }

  .ia-mail .ia-ml-count {
    font-size: 0.82em;
  }

  .ia-mail .ia-ml-brand {
    display: none;
  }
}

/* ---------- Keyframes ---------- */

@keyframes ia-ml-pop {
  from {
    opacity: 0;
    transform: scale(0.85);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes ia-ml-scan {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(100%);
  }
}

@keyframes ia-ml-flash {
  from {
    background-color: #fde7e5;
  }
  to {
    background-color: transparent;
  }
}

/* ---------- Static: nothing moves ---------- */

.ia-mail.is-static *,
.ia-mail.is-static *::before,
.ia-mail.is-static *::after {
  transition: none !important;
  animation: none !important;
}
