:root {
  --fondo: #000000;
  --card: #0e1014;
  --card-alto: #15181e;
  --bordo: rgba(255, 255, 255, 0.08);
  --testo: #f3f4f7;
  --tenue: rgba(243, 244, 247, 0.52);
  --spento: rgba(243, 244, 247, 0.32);
  --accento: #93a6ff;
  --accento-scuro: #0c1020;
  --riga: clamp(40px, 8.6vh, 56px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  background: var(--fondo);
  color: var(--testo);
  font-family: 'Mona Sans Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

.stage {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 12px;
}

.mail {
  position: relative;
  width: min(410px, calc(100vw - 24px));
  padding: clamp(12px, 3.2vh, 20px) clamp(12px, 3.4vw, 18px) clamp(10px, 2.6vh, 16px);
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0) 38%),
    var(--card);
  border: 1px solid var(--bordo);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.09),
    0 1px 2px rgba(0, 0, 0, 0.6),
    0 12px 30px -10px rgba(0, 0, 0, 0.8),
    0 40px 80px -30px rgba(70, 90, 200, 0.28);
  overflow: hidden;
  isolation: isolate;
}

.mail__glow {
  position: absolute;
  left: 0;
  top: -120px;
  width: 260px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(147, 166, 255, 0.22), rgba(147, 166, 255, 0));
  pointer-events: none;
  z-index: -1;
  will-change: transform;
}

.mail__head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: clamp(10px, 2.4vh, 16px);
}

.mail__mark {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: linear-gradient(160deg, #a9b8ff, #6b80f0);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 4px 12px -4px rgba(120, 140, 255, 0.7);
}

.mail__mark svg { width: 17px; height: 17px; fill: none; stroke: #0c1020; stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }

.mail__titles { display: flex; flex-direction: column; line-height: 1.1; }
.mail__app { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--spento); font-weight: 560; }
.mail__title { font-size: clamp(17px, 4.2vh, 21px); font-weight: 640; font-stretch: 112%; letter-spacing: -0.01em; }

.mail__me {
  margin-left: auto;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 620;
  color: #1a1206;
  background: linear-gradient(150deg, #ffd9a8, #e9a76a);
  box-shadow: 0 0 0 2px var(--card), 0 0 0 3px rgba(255, 255, 255, 0.1);
}

.tabs {
  position: relative;
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: clamp(6px, 1.6vh, 10px);
}

.tabs__pill {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 0;
  width: 10px;
  border-radius: 11px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0.06));
  border: 1px solid rgba(255, 255, 255, 0.13);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 6px 16px -6px rgba(0, 0, 0, 0.9);
  overflow: hidden;
  transform-origin: 50% 50%;
  will-change: transform, width;
}

.tabs__shine {
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, 0.16) 50%, transparent 70%);
  transform: translateX(-120%);
}

.tab {
  position: relative;
  flex: 1 1 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  min-width: 0;
  height: clamp(32px, 7.4vh, 38px);
  padding: 0 clamp(6px, 2vw, 12px);
  border: 0;
  border-radius: 11px;
  background: none;
  color: var(--tenue);
  font: inherit;
  font-size: clamp(12px, 3.2vw, 13.5px);
  font-weight: 560;
  cursor: pointer;
  transition: color 0.3s ease;
  -webkit-tap-highlight-color: transparent;
}

.tab[aria-selected='true'] { color: var(--testo); }
.tab:focus-visible { outline: 2px solid var(--accento); outline-offset: 1px; }

@media (hover: hover) {
  .tab:not([aria-selected='true']):hover { color: rgba(243, 244, 247, 0.8); }
}

.tab__label { white-space: nowrap; }

.badge {
  display: inline-flex;
  overflow: hidden;
  max-width: 30px;
  margin-left: 6px;
  will-change: transform;
}

.badge__in {
  display: block;
  height: 18px;
  min-width: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--accento);
  color: var(--accento-scuro);
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 2px 8px -2px rgba(147, 166, 255, 0.8);
  font-variant-numeric: tabular-nums;
}

.badge__col { display: flex; flex-direction: column; will-change: transform; }
.badge__col span { display: block; height: 18px; }

.tab[aria-selected='true'] .badge__in { background: #c7d0ff; }

.list {
  position: relative;
  height: calc(var(--riga) * 4);
  overflow: hidden;
}

.row {
  position: absolute;
  left: 0;
  right: 0;
  height: var(--riga);
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 8px;
  border-radius: 12px;
  will-change: transform, opacity;
}

.row::after {
  content: '';
  position: absolute;
  left: 50px;
  right: 8px;
  bottom: 0;
  height: 1px;
  background: rgba(255, 255, 255, 0.05);
}

.row:last-child::after { display: none; }

@media (hover: hover) {
  .row:hover { background: rgba(255, 255, 255, 0.035); }
}

.row__av {
  flex: none;
  width: clamp(28px, 6.4vh, 32px);
  height: clamp(28px, 6.4vh, 32px);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 650;
  color: rgba(10, 10, 14, 0.85);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.row__txt { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }

.row__from {
  font-size: clamp(12.5px, 3vh, 13.5px);
  color: var(--tenue);
  font-weight: 460;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: font-weight 0.5s ease, color 0.5s ease;
}

.row__subj {
  font-size: clamp(11.5px, 2.7vh, 12.5px);
  color: var(--spento);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.5s ease;
}

.row__time {
  flex: none;
  align-self: flex-start;
  margin-top: calc(var(--riga) / 2 - 15px);
  font-size: 11px;
  color: var(--spento);
  font-variant-numeric: tabular-nums;
  transition: color 0.5s ease;
}

.row.is-new .row__from { color: var(--testo); font-weight: 680; }
.row.is-new .row__subj { color: rgba(243, 244, 247, 0.7); }
.row.is-new .row__time { color: var(--accento); }

.mail__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: clamp(6px, 1.6vh, 10px);
  padding-top: clamp(8px, 1.8vh, 12px);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 11.5px;
  color: var(--spento);
}

.foot__state { position: relative; display: block; height: 16px; flex: 1; overflow: hidden; }
.foot__line { position: absolute; left: 0; top: 0; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.foot__line svg { width: 13px; height: 13px; fill: none; stroke: var(--accento); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.foot__sync svg { width: 15px; height: 15px; fill: none; stroke: var(--spento); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; display: block; }

.cursor {
  position: fixed;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  pointer-events: none;
  z-index: 10;
  opacity: 0;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.6));
}

.cursor path { fill: #fff; stroke: #0b0d12; stroke-width: 1.2; stroke-linejoin: round; }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
