:root {
  --fondo: #fafafa;
  --card: #ffffff;
  --inchiostro: #121214;
  --grigio: #6c6c73;
  --tenue: #9a9aa1;
  --linea: rgba(18, 18, 20, 0.07);
  --avviso: #151517;
  --avviso-testo: #f4f4f6;
  --anello: #9aa6ff;
  --anello-fine: #ffb86b;
  --annulla: #c9d0ff;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--fondo);
  color: var(--inchiostro);
  font-family: "Mona Sans Variable", "Mona Sans", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.stage {
  position: relative;
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(10px, 2.4vh, 22px);
  padding: 16px;
}

/* the inbox card */
.inbox {
  width: min(430px, 100%);
  background: var(--card);
  border: 1px solid var(--linea);
  border-radius: 20px;
  box-shadow: 0 1px 2px rgba(18, 18, 20, 0.04), 0 18px 48px -18px rgba(18, 18, 20, 0.16);
  overflow: hidden;
}

.inbox__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: clamp(12px, 2.6vh, 18px) 18px clamp(8px, 1.6vh, 12px);
  border-bottom: 1px solid var(--linea);
}

.inbox__title {
  margin: 0;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.inbox__count {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--grigio);
  font-variant-numeric: tabular-nums;
}

.inbox__app {
  font-size: 12px;
  color: var(--tenue);
}

.list {
  list-style: none;
  margin: 0;
  padding: 4px 0;
  position: relative;
}

.row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  height: clamp(44px, 10.4vh, 60px);
  padding: 0 14px 0 16px;
  background: var(--card);
}

.row + .row::before {
  content: "";
  position: absolute;
  left: 60px;
  right: 14px;
  top: 0;
  border-top: 1px solid var(--linea);
}

.row.is-gone { display: none; }

.row__glow {
  position: absolute;
  inset: 2px 6px;
  border-radius: 12px;
  background: rgba(154, 166, 255, 0.16);
  opacity: 0;
  pointer-events: none;
}

.row__avatar {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--tint);
  color: var(--ink);
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.02em;
}

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

.row__top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.row__name {
  font-size: 14px;
  font-weight: 600;
}

.row__time {
  font-size: 12px;
  color: var(--tenue);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  transition: opacity 0.18s;
}

.row__subject {
  font-size: 13px;
  color: var(--grigio);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row__archive {
  position: absolute;
  right: 12px;
  top: 50%;
  width: 32px;
  height: 32px;
  margin-top: -16px;
  border: 1px solid var(--linea);
  border-radius: 10px;
  background: #fff;
  color: var(--inchiostro);
  display: grid;
  place-items: center;
  cursor: pointer;
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.18s, transform 0.22s cubic-bezier(0.3, 1.6, 0.5, 1), box-shadow 0.2s;
  box-shadow: 0 2px 6px -2px rgba(18, 18, 20, 0.15);
}

.row__archive svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.row__archive .lid {
  transform-box: fill-box;
  transform-origin: 0% 100%;
  transition: transform 0.25s cubic-bezier(0.3, 1.6, 0.5, 1);
}

.row.is-hot .row__archive { opacity: 1; transform: scale(1); }
.row.is-hot .row__time { opacity: 0; }
.row.is-hot { background: #f6f6f8; }
.row.is-hot .row__archive .lid { transform: rotate(-14deg) translateY(-1px); }
.row__archive.is-pressed { transform: scale(0.88) !important; box-shadow: none; }
.row__archive:focus-visible { outline: 2px solid var(--anello); outline-offset: 2px; opacity: 1; transform: scale(1); }

@media (hover: hover) {
  .row:hover { background: #f6f6f8; }
  .row:hover .row__archive { opacity: 1; transform: scale(1); }
  .row:hover .row__time { opacity: 0; }
  .row__archive:hover .lid { transform: rotate(-14deg) translateY(-1px); }
  .row__archive:hover { box-shadow: 0 4px 10px -3px rgba(18, 18, 20, 0.22); }
}

@media (hover: none) {
  .row__archive { opacity: 0.55; transform: scale(1); }
  .row__time { opacity: 0; }
  .row__body { padding-right: 40px; }
}

/* the toasts, stacked from the bottom */
.toasts {
  position: relative;
  width: min(380px, 100%);
  height: 54px;
  flex: none;
  z-index: 3;
}

.toast {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 54px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 0 12px;
  background: var(--avviso);
  color: var(--avviso-testo);
  border-radius: 16px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 14px 34px -14px rgba(10, 10, 12, 0.55), 0 2px 6px rgba(10, 10, 12, 0.18);
  transform-origin: 50% 100%;
  will-change: transform;
}

.toast__ring {
  position: relative;
  flex: none;
  width: 28px;
  height: 28px;
}

.toast__ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring__track,
.ring__run {
  fill: none;
  stroke-width: 2;
}

.ring__track { stroke: rgba(255, 255, 255, 0.12); }
.ring__run { stroke: var(--anello); stroke-linecap: round; }

.toast__num {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  font-size: 11.5px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.toast__num > span {
  grid-area: 1 / 1;
}

.toast__text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1.2;
}

.toast__text strong {
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toast__who {
  font-size: 12px;
  color: rgba(244, 244, 246, 0.55);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toast__undo {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--annulla);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s, transform 0.2s cubic-bezier(0.3, 1.6, 0.5, 1);
}

.toast__undo svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.toast__undo.is-pressed { transform: scale(0.92); }
.toast__undo:focus-visible { outline: 2px solid var(--annulla); outline-offset: 2px; }

@media (hover: hover) {
  .toast__undo:hover { background: rgba(255, 255, 255, 0.14); }
}

/* the fake pointer of the autopilot */
.ghost {
  position: absolute;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  z-index: 10;
  pointer-events: none;
  opacity: 0;
  fill: #121214;
  stroke: #fff;
  stroke-width: 1.4;
  stroke-linejoin: round;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.25));
  transform-origin: 20% 15%;
}

@media (max-width: 380px) {
  .row { gap: 10px; padding-left: 12px; }
  .row + .row::before { left: 54px; }
  .row__subject { font-size: 12.5px; }
}
