/* ==========================================================================
   La démo : une boîte mail pro façon webmail, animée en boucle (demo-mail.js)
   ========================================================================== */
.webmail { --row: 41px; --rows: 8; container-type: inline-size; position: relative; overflow: hidden; border-radius: 16px; background: #f6f8fc; color: #1f1f1f;
  font: 400 13px/1.35 "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; letter-spacing: 0;
  box-shadow: 0 30px 80px #000b, 0 0 0 1px #ffffff22, 0 0 60px #2fe0f01a; user-select: none; }
.webmail .wm-ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* top bar */
.wm-top { display: flex; align-items: center; gap: 14px; height: 54px; padding: 0 14px; color: #444746; }
.wm-brand { display: flex; align-items: center; gap: 8px; font-size: 19px; color: #444746; white-space: nowrap; }
.wm-brand i { width: 26px; height: 20px; border-radius: 4px; background: linear-gradient(135deg, #0f9d8a 0 50%, #e3b26a 50%); position: relative; }
.wm-brand i::after { content: ""; position: absolute; inset: 3px 3px auto; height: 9px; border: 2px solid #fff; border-top: 0; border-radius: 0 0 8px 8px; transform: skewY(0); }
.wm-brand small { font-size: 11px; font-weight: 600; color: #0f9d8a; text-transform: uppercase; letter-spacing: .08em; }
.wm-search { flex: 1; display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 14px; border-radius: 99px; background: #e9eef6; color: #5f6368; min-width: 0;
  white-space: nowrap; overflow: hidden; }
.wm-nour { display: flex; align-items: center; gap: 5px; font-style: normal; font-size: 12px; font-weight: 600; color: #0b5e55; background: #d6f5f0; padding: 5px 10px;
  border-radius: 99px; white-space: nowrap; }
.wm-nour .wm-ico { width: 14px; height: 14px; color: #0f9d8a; }
.webmail.busy .wm-nour .wm-ico { animation: wm-spin 1.2s linear infinite; }
/* our logo, top right (like an organisation logo in a pro webmail): on a dark pill, the logo is made for dark backgrounds */
.wm-org { display: flex; align-items: center; height: 40px; padding: 0 14px; border-radius: 12px; flex: none;
  background: radial-gradient(ellipse at 30% 50%, #0b3a36, #031a19 75%); box-shadow: 0 0 0 1px #e3b26a55, 0 4px 12px #031a1933; }
.wm-org img { display: block; height: 30px; width: auto; }

/* body: sidebar + main */
.wm-body { display: grid; grid-template-columns: 190px 1fr; height: calc(var(--row) * var(--rows) + 66px); padding-right: 12px; padding-bottom: 12px; }
.wm-side { display: flex; flex-direction: column; gap: 1px; padding: 4px 10px 0 8px; color: #1f1f1f; overflow: hidden; }
.wm-compose { display: inline-flex; align-items: center; gap: 10px; align-self: flex-start; margin: 2px 0 10px; padding: 14px 18px; border-radius: 16px; background: #c2e7ff;
  font-weight: 600; white-space: nowrap; box-shadow: 0 1px 2px #0000001a; }
.wm-f { display: flex; align-items: center; gap: 12px; height: 30px; padding: 0 10px 0 14px; border-radius: 0 99px 99px 0; white-space: nowrap; transition: background .3s; }
.wm-f.on { background: #d3e3fd; font-weight: 700; }
.wm-f b { margin-left: auto; font-size: 12px; font-weight: 700; transition: transform .3s; }
.wm-f b:empty { display: none; }
.wm-f b.pop { animation: wm-pop .5s var(--ease-out, ease-out); }
.wm-f.t i { width: 12px; height: 12px; margin: 0 3px; border-radius: 3px; background: var(--c); }
.wm-f.flash { background: #e8f0fe; }
.wm-lbl { margin: 10px 0 4px 14px; font-size: 12px; font-weight: 600; color: #444746; }

.wm-main { position: relative; background: #fff; border-radius: 16px; overflow: hidden; }
.wm-tools { display: flex; align-items: center; gap: 16px; height: 48px; padding: 0 16px; border-bottom: 1px solid #eceff1; color: #5f6368; }
.wm-tabs { display: flex; gap: 2px; }
.wm-tabs span { padding: 0 14px; line-height: 46px; font-size: 13px; font-weight: 600; border-bottom: 3px solid transparent; }
.wm-tabs span.on { color: #0b57d0; border-color: #0b57d0; }
.wm-count { margin-left: auto; font-size: 12px; white-space: nowrap; }
.wm-cb { width: 14px; height: 14px; border: 2px solid #8c9196; border-radius: 3px; flex: none; }

/* the rows */
.wm-list { position: relative; list-style: none; margin: 0; padding: 0; height: calc(var(--row) * var(--rows)); }
.wm-list li { position: absolute; left: 0; right: 0; top: calc(var(--slot, 0) * var(--row)); height: var(--row); display: grid;
  grid-template-columns: 14px 18px 128px 1fr 44px; align-items: center; gap: 12px; padding: 0 16px; border-bottom: 1px solid #f1f3f4; background: #fff;
  transition: top .7s cubic-bezier(.2, 0, 0, 1), opacity .45s, transform .55s cubic-bezier(.2, 0, 0, 1), background .3s, box-shadow .3s; }
.wm-list li.hide { opacity: 0; transform: translateY(-14px); }
.wm-list li .st { color: #c4c7c5; width: 17px; height: 17px; }
.wm-list li b { font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wm-list li p { margin: 0; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #5f6368; }
.wm-list li p strong { font-weight: 400; color: #1f1f1f; }
.wm-list li time { text-align: right; font-size: 12px; color: #5f6368; }
.wm-list li.unread { background: #fff; }
.wm-list li.unread b, .wm-list li.unread p strong, .wm-list li.unread time { font-weight: 700; color: #1f1f1f; }
.wm-list li:not(.unread) { background: #f2f6fc; }
.wm-list li.scan { box-shadow: inset 3px 0 0 #0f9d8a; background: #e6f7f4; }
.wm-list li.gone { opacity: 0; transform: translateX(60%); }
.wm-list li.prio .st { color: #f4b400; fill: #f4b400; }
[dir="rtl"] { font-family: "Segoe UI", Tahoma, Arial, sans-serif; }

/* label chips inside the row */
.chips { display: inline-flex; gap: 4px; margin-right: 6px; vertical-align: 1px; }
.chip { display: inline-block; padding: 1px 7px; border-radius: 4px; font-size: 11px; font-weight: 600; line-height: 17px; white-space: nowrap;
  animation: wm-chip .45s cubic-bezier(.2, 0, 0, 1) both; }
.chip.urgent { background: #fce8e6; color: #c5221f; }
.chip.client { background: #e8f0fe; color: #1967d2; }
.chip.facture { background: #fef7e0; color: #a05a00; }
.chip.spam { background: #eceff1; color: #5f6368; }
.chip.team { background: #fff; border: 1px solid var(--c); color: var(--c); }
.chip.relance { background: #e6f4ea; color: #137333; }

/* opened message */
.wm-read { position: absolute; inset: 0; background: #fff; padding: 12px 22px 16px; transform: translateX(102%); transition: transform .6s cubic-bezier(.2, 0, 0, 1); overflow: hidden; }
.webmail.reading .wm-read { transform: none; }
.wm-read header { display: flex; align-items: center; gap: 14px; color: #444746; }
.wm-read h4 { margin: 0; font: 400 19px/1.3 "Segoe UI", Tahoma, Arial, sans-serif; color: #1f1f1f; }
.wm-from { display: flex; align-items: center; gap: 10px; margin: 14px 0 6px; }
.wm-from p { margin: 0; }
.wm-from b { display: block; font-weight: 700; }
.wm-from small { color: #5f6368; font-size: 12px; }
.wm-av { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: #0f9d8a; color: #fff; font-size: 12px; font-weight: 600; }
.wm-msg { margin: 6px 44px 14px 0; font-size: 15px; line-height: 1.6; }
.wm-draft { border: 1px solid #c4e8e2; border-radius: 12px; padding: 12px 14px; background: #f3fbf9; opacity: 0; transform: translateY(14px);
  transition: opacity .4s, transform .5s cubic-bezier(.2, 0, 0, 1); }
.webmail.drafting .wm-draft { opacity: 1; transform: none; }
.wm-dh { display: flex; align-items: center; gap: 6px; margin: 0 0 8px; font-size: 12px; font-weight: 600; color: #0b5e55; }
.wm-dh .wm-ico { width: 15px; height: 15px; color: #0f9d8a; }
.wm-dh span { font-weight: 400; color: #5f6368; }
.wm-langs { display: flex; gap: 6px; margin-bottom: 8px; }
.wm-langs span { padding: 2px 10px; border-radius: 99px; border: 1px solid #c4c7c5; font-size: 11px; color: #444746; transition: all .3s; }
.wm-langs span.on { background: #0f9d8a; border-color: #0f9d8a; color: #fff; }
.wm-draft .draft { display: none; margin: 0; min-height: 46px; font-size: 14px; line-height: 1.6; color: #1f1f1f; }
.wm-draft .draft.on { display: block; }
.wm-draft .draft[dir="rtl"] { font-size: 15px; }
.wm-draft .caret { display: inline-block; width: 2px; height: 1em; background: #0f9d8a; vertical-align: -2px; margin-inline: 2px; animation: md-caret 1s steps(2) infinite; }
@keyframes md-caret { 50% { opacity: 0; } }
.wm-send { display: flex; gap: 8px; margin-top: 10px; }
.wm-btn { padding: 8px 18px; border-radius: 99px; background: #0b57d0; color: #fff; font-weight: 600; font-size: 13px; transition: transform .15s, filter .2s; }
.wm-btn.ghost { background: transparent; color: #0b57d0; border: 1px solid #c4c7c5; }
.wm-btn.press { transform: scale(.94); filter: brightness(1.2); }

/* morning summary: a pinned message from Nour */
.wm-summary { position: absolute; left: 50%; top: 50%; width: min(400px, 86%); padding: 20px 22px; border-radius: 16px; background: #fff; color: #1f1f1f;
  box-shadow: 0 24px 60px #0003, 0 0 0 1px #e3b26a; transform: translate(-50%, -40%) scale(.94); opacity: 0;
  transition: opacity .45s, transform .6s cubic-bezier(.2, 0, 0, 1); }
.webmail.summary .wm-summary { opacity: 1; transform: translate(-50%, -50%); }
.webmail.summary .wm-list { filter: blur(2px); opacity: .5; transition: filter .5s, opacity .5s; }
.wm-list { transition: filter .5s, opacity .5s; }
.wm-sum-h { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 12px; font-weight: 700; color: #a05a00; letter-spacing: .04em; text-transform: uppercase; }
.wm-sum-h time { margin-left: auto; color: #5f6368; font-weight: 400; }
.wm-sum-h .wm-ico { width: 15px; height: 15px; }
.wm-sum-big { margin: 10px 0 12px; font-size: 18px; font-weight: 600; }
.wm-sum-big b { display: block; font-size: 46px; line-height: 1.05; color: #0f9d8a; letter-spacing: -.03em; }
.wm-summary ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; font-size: 14px; }
.wm-summary li { opacity: 0; transform: translateX(-8px); transition: opacity .35s, transform .45s cubic-bezier(.2, 0, 0, 1); }
.webmail.summary .wm-summary li { opacity: 1; transform: none; }
.webmail.summary .wm-summary li:nth-child(2) { transition-delay: .15s; } .webmail.summary .wm-summary li:nth-child(3) { transition-delay: .3s; }
.webmail.summary .wm-summary li:nth-child(4) { transition-delay: .45s; }
.wm-summary li b { color: #a05a00; margin-right: 6px; }
.wm-summary small { display: block; margin-top: 12px; color: #80868b; font-size: 11px; }

/* toast, cursor */
.wm-toast { position: absolute; left: 24px; bottom: 22px; padding: 12px 18px; border-radius: 6px; background: #303030; color: #fff; font-size: 13px;
  transform: translateY(80px); transition: transform .45s cubic-bezier(.2, 0, 0, 1); }
.webmail.toast .wm-toast { transform: none; }
.wm-cursor { position: absolute; left: 0; top: 0; width: 18px; height: 18px; z-index: 5; pointer-events: none; opacity: 0;
  transform: translate(var(--cx, 60%), var(--cy, 60%)); transition: transform calc(.9s / var(--rate, 1)) cubic-bezier(.45, 0, .2, 1), opacity .3s;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 2l15 11-7 1 4 8-3 1.4-4-8L4 20z' fill='%23111' stroke='%23fff' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat;
  filter: drop-shadow(0 2px 3px #0005); }
.webmail.cursor .wm-cursor { opacity: 1; }
.wm-cursor.click::after { content: ""; position: absolute; left: -9px; top: -9px; width: 20px; height: 20px; border-radius: 50%; background: #0f9d8a66; animation: wm-ripple .5s ease-out forwards; }

/* the whole loop fades between two runs */
.webmail .wm-body { transition: opacity .5s; }
.webmail.reset .wm-body { opacity: 0; }

@keyframes wm-chip { from { opacity: 0; transform: scale(.6); } }
@keyframes wm-pop { 40% { transform: scale(1.5); color: #0f9d8a; } }
@keyframes wm-ripple { from { transform: scale(.3); opacity: 1; } to { transform: scale(1.8); opacity: 0; } }
@keyframes wm-spin { to { transform: rotate(360deg); } }

/* ---------- the avalanche: the same mailbox, before Nour (flood-mail.js) ---------- */
@container (min-width: 661px) {
  .wm-flood .wm-body { grid-template-columns: 218px 1fr; }     /* room for the four-digit unread count */
}
@container (max-width: 420px) {
  .wm-flood .wm-tabs span:nth-child(3) { display: none; }      /* narrow: « Principale 26 nouveaux » keeps one line */
}
.wm-tabs span { white-space: nowrap; }
.wm-flood .wm-list li { transition: top .38s cubic-bezier(.2, 0, 0, 1), opacity .3s, transform .4s cubic-bezier(.2, 0, 0, 1), background .6s, box-shadow .6s; }
.wm-flood .wm-list li.enter { transition: none; opacity: 0; transform: translateY(-14px); }
.wm-flood .wm-list li.jump { transition: none; }
.wm-flood .wm-list li.far { opacity: 0; }
.wm-flood .wm-list li.hot { background: #fce8e6; box-shadow: inset 3px 0 0 #d93025; }
.wm-flood .wm-list li b small { margin-left: 3px; font-size: 11px; font-weight: 400; color: #5f6368; }
.wm-flood .wm-list li.unread b small { font-weight: 400; }
.wm-flood .wm-f b.hot { color: #d93025; font-variant-numeric: tabular-nums; }
.wm-new { display: inline-block; margin-left: 7px; padding: 0 7px; border-radius: 99px; background: #d93025; color: #fff; font-style: normal; font-size: 10.5px;
  font-weight: 700; line-height: 17px; vertical-align: 1px; }
.wm-new:empty { display: none; }
.wm-flood .wm-count { font-variant-numeric: tabular-nums; }
.wm-flood .wm-main { transition: box-shadow .8s; }
.wm-flood.over .wm-main { box-shadow: inset 0 0 0 2px #d9302566, inset 0 -50px 60px -30px #d9302526; }
/* on the right: this mailbox sits on the left of the page, where the floating « Audit gratuit » button is */
.wm-flood .wm-toast { left: auto; right: 24px; max-width: calc(100% - 48px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wm-flood .wm-toast b { color: #f6aea9; }

/* the panel adapts to its own width (cinematic panel, free mode, tablet), not to the screen */
@container (max-width: 660px) {
  .wm-body { grid-template-columns: 1fr; padding-left: 12px; }
  .wm-side { display: none; }
  .wm-list li { grid-template-columns: 14px 18px 116px 1fr 44px; }
}
@container (max-width: 520px) {
  .wm-brand small, .wm-count { display: none; }
}
@media (max-width: 730px) {
  .webmail { --row: 52px; --rows: 6; font-size: 12px; }
  .wm-top { gap: 8px; height: 48px; padding: 0 10px; }
  .wm-brand { display: none; }
  .wm-org { height: 34px; padding: 0 9px; border-radius: 10px; }
  .wm-org img { height: 24px; }
  .wm-search { height: 34px; font-size: 12px; }
  .wm-body { padding: 0 8px 8px; }
  .wm-tools { height: 40px; gap: 10px; padding: 0 12px; }
  .wm-tabs span { line-height: 38px; padding: 0 8px; font-size: 12px; }
  .wm-tools .wm-cb, .wm-count { display: none; }
  .wm-list li { grid-template-columns: 1fr 40px; grid-template-rows: auto auto; gap: 0 8px; padding: 6px 12px; align-content: center; }
  .wm-list li .wm-cb, .wm-list li .st { display: none; }
  .wm-list li b { grid-column: 1; grid-row: 1; }
  .wm-list li time { grid-column: 2; grid-row: 1; }
  .wm-list li p { grid-column: 1 / -1; grid-row: 2; }
  .wm-read { padding: 10px 14px; }
  .wm-read h4 { font-size: 16px; }
  .wm-msg { margin-right: 0; font-size: 14px; margin-bottom: 10px; }
  .wm-from { margin-top: 8px; }
  .wm-draft .draft { font-size: 13px; min-height: 40px; }
  .wm-sum-big b { font-size: 38px; }
}
@media (prefers-reduced-motion: reduce) {
  .webmail *, .webmail { transition: none !important; animation: none !important; }
}
