/* BMAIL — design system Gmail (Material 3), 1:1 : couleurs, tailles, rayons, ombres, police Roboto/Google Sans. */
:root {
  --bg: #f6f8fc;           /* fond page Gmail */
  --surface: #fff;
  --text: #1f1f1f;         /* on-surface */
  --text2: #444746;        /* on-surface-variant (icônes, texte secondaire) */
  --text3: #5e5e5e;        /* extraits, méta */
  --blue: #0b57d0;         /* primary */
  --blue-dk: #0842a0;
  --sel: #d3e3fd;          /* item de nav sélectionné */
  --check: #c2dbff;        /* ligne cochée */
  --compose: #c2e7ff;      /* bouton Nouveau message */
  --compose-t: #001d35;
  --read-bg: #f2f6fc;      /* ligne lue */
  --search: #e9eef6;       /* barre de recherche */
  --hover: rgba(68, 71, 70, .08);
  --outline: #747775;
  --border: #dadce0;
  --border-lt: #e3e6ea;
  --star: #f4b400;
  --font: Roboto, "Google Sans", "Helvetica Neue", Arial, sans-serif;
  --font-hd: "Google Sans", Roboto, "Helvetica Neue", Arial, sans-serif;
  --sh1: 0 1px 2px 0 rgba(60, 64, 67, .3), 0 1px 3px 1px rgba(60, 64, 67, .15);
  --sh2: 0 1px 3px 0 rgba(60, 64, 67, .3), 0 4px 8px 3px rgba(60, 64, 67, .15);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/20px var(--font); -webkit-font-smoothing: antialiased; overflow: hidden; }
button { font-family: inherit; }
.boot { padding: 40px; color: var(--text3); }
svg { display: block; }

/* ---------- boutons icône (40px rond, comme Gmail) ---------- */
.ib { width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent; color: var(--text2); display: inline-grid; place-items: center; cursor: pointer; padding: 0; flex-shrink: 0; }
.ib:hover { background: var(--hover); }
.ib:active { background: rgba(68, 71, 70, .12); }
.ib svg { width: 20px; height: 20px; }
.ib.xs { width: 32px; height: 32px; }
.ib:disabled { opacity: .38; cursor: default; }
.ib:disabled:hover { background: transparent; }
.ib.on { color: var(--star); }

/* ---------- structure ---------- */
.gm { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.gm-top { height: 64px; display: flex; align-items: center; padding: 8px; gap: 8px; flex-shrink: 0; }
.gm-top-l { width: 238px; display: flex; align-items: center; gap: 4px; padding-left: 4px; flex-shrink: 0; }
.gm-logo { display: flex; align-items: center; gap: 8px; padding: 0 8px; font-family: var(--font-hd); font-size: 22px; color: var(--text2); text-decoration: none; user-select: none; }
.gm-logo-m { width: 30px; height: 30px; border-radius: 7px; background: var(--blue); color: #fff; font-weight: 700; font-size: 17px; display: grid; place-items: center; }
.gm-search { flex: 1; max-width: 720px; height: 48px; background: var(--search); border-radius: 24px; display: flex; align-items: center; padding: 0 4px; margin: 0; transition: background .15s, box-shadow .15s; }
.gm-search:focus-within { background: #fff; box-shadow: 0 1px 1px 0 rgba(65, 69, 73, .3), 0 1px 3px 1px rgba(65, 69, 73, .15); }
.gm-search input { flex: 1; min-width: 0; border: 0; background: transparent; font: 16px var(--font); outline: none; color: var(--text); height: 100%; padding: 0 4px; }
.gm-search input::placeholder { color: var(--text2); }
.gm-top-r { margin-left: auto; display: flex; align-items: center; gap: 4px; padding-right: 8px; }
.gm-ws { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 8px 0 4px; border-radius: 20px; border: 0; background: transparent; cursor: pointer; color: var(--text2); }
.gm-ws:hover { background: var(--hover); }
.gm-ws svg { width: 18px; height: 18px; }
.av { border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 500; position: relative; overflow: hidden; flex-shrink: 0; }
.av img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #fff; }
.gm-ws .av { width: 32px; height: 32px; font-size: 13px; }
.gm-ws-t { display: flex; flex-direction: column; align-items: flex-start; line-height: 15px; text-align: left; }
.gm-ws-t b { font-size: 13px; color: var(--text); font-weight: 500; }
.gm-ws-t span { font-size: 11px; color: var(--text3); }
.gm-me { width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent; padding: 0; display: grid; place-items: center; cursor: pointer; }
.gm-me:hover { background: var(--hover); }
.gm-me .av { width: 32px; height: 32px; background: var(--blue); font-size: 14px; }

.gm-body { flex: 1; display: flex; min-height: 0; }

/* ---------- rail gauche ---------- */
.gm-nav { width: 256px; flex-shrink: 0; padding: 8px 0 16px; display: flex; flex-direction: column; overflow-y: auto; overflow-x: hidden; transition: width .15s; }
.gm-compose { margin: 0 0 16px 8px; height: 56px; padding: 0 24px 0 16px; border-radius: 16px; border: 0; background: var(--compose); color: var(--compose-t); font: 500 14px var(--font-hd); display: inline-flex; align-items: center; gap: 16px; cursor: pointer; width: fit-content; transition: box-shadow .2s, width .15s; white-space: nowrap; }
.gm-compose:hover { box-shadow: var(--sh2); }
.gm-compose svg { width: 24px; height: 24px; flex-shrink: 0; }
.nav-i { display: flex; align-items: center; height: 32px; padding: 0 12px 0 26px; margin-right: 12px; border-radius: 0 16px 16px 0; border: 0; background: transparent; font: 14px var(--font); color: #202124; cursor: pointer; width: calc(100% - 12px); text-align: left; white-space: nowrap; }
.nav-i svg { width: 20px; height: 20px; margin-right: 18px; flex-shrink: 0; color: var(--text2); }
.nav-i:hover { background: var(--hover); }
.nav-i.on { background: var(--sel); font-weight: 700; }
.nav-i.on svg { color: #202124; }
.nav-i .lb { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.nav-i .ct { font-size: 12px; font-weight: 700; color: #202124; }
.gm-labels-h { display: flex; align-items: center; justify-content: space-between; padding: 0 8px 0 26px; height: 40px; font: 500 14px var(--font-hd); color: #202124; margin-top: 8px; }
.gm-labels-h .ib { width: 32px; height: 32px; }
.nav-empty { padding: 4px 26px; font-size: 12px; color: var(--text3); }
.gm.collapsed .gm-nav { width: 72px; }
.gm.collapsed .gm-compose { width: 56px; padding: 0 16px; gap: 0; }
.gm.collapsed .gm-compose span, .gm.collapsed .nav-i .lb, .gm.collapsed .nav-i .ct, .gm.collapsed .gm-labels-h span, .gm.collapsed .nav-empty { display: none; }
.gm.collapsed .gm-labels-h { padding-left: 18px; }

/* ---------- zone principale (carte blanche arrondie) ---------- */
.gm-main { flex: 1; min-width: 0; background: var(--surface); border-radius: 16px; margin: 0 16px 16px 0; display: flex; flex-direction: column; overflow: hidden; }
.gm-tb { height: 48px; display: flex; align-items: center; padding: 0 16px 0 12px; flex-shrink: 0; }
.tb-sep { width: 1px; height: 20px; background: var(--border); margin: 0 8px; }
.tb-chk { display: flex; align-items: center; margin-right: 4px; }
.tb-chk .ib.dd { width: 20px; margin-left: -6px; }
.tb-chk .ib.dd svg { width: 18px; height: 18px; }
.tb-r { margin-left: auto; display: flex; align-items: center; font-size: 12px; color: var(--text2); }
.tb-count { margin-right: 8px; white-space: nowrap; }
.tb-count b { font-weight: 700; color: var(--text); }
.gm-rows { flex: 1; overflow-y: auto; }
.empty { padding: 56px 24px; text-align: center; color: var(--text3); font-size: 14px; }

/* ligne = 40px, façon Gmail */
.row { display: flex; align-items: center; height: 40px; padding: 0 16px 0 8px; font-size: 14px; color: var(--text2); background: var(--read-bg); cursor: pointer; position: relative; border-bottom: 1px solid #f0f2f5; user-select: none; }
.row.unread { background: #fff; color: var(--text); font-weight: 700; }
.row:hover { box-shadow: inset 1px 0 0 var(--border), inset -1px 0 0 var(--border), 0 1px 2px 0 rgba(60, 64, 67, .3), 0 1px 3px 1px rgba(60, 64, 67, .15); z-index: 1; }
.row.checked, .row.checked:hover { background: var(--check); }
.row-l { display: flex; align-items: center; flex-shrink: 0; width: 72px; }
.row-from { width: 200px; flex-shrink: 0; padding-right: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-subj { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-subj .sn { color: var(--text3); font-weight: 400; }
.row-att { flex-shrink: 0; margin: 0 8px; color: var(--text2); display: grid; }
.row-att svg { width: 18px; height: 18px; }
.row-date { width: 88px; flex-shrink: 0; text-align: right; font-size: 12px; padding-left: 8px; white-space: nowrap; }
.row-acts { display: none; position: absolute; right: 8px; top: 0; bottom: 0; align-items: center; background: inherit; padding-left: 8px; }
.row-acts .ib { width: 32px; height: 32px; }
.row:hover .row-date { visibility: hidden; }
.row:hover .row-acts { display: flex; }

/* ---------- lecture ---------- */
.gm-read { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.gm-read[hidden], [hidden] { display: none !important; }
.rd-scroll { flex: 1; overflow-y: auto; padding-bottom: 48px; }
.rd-subj { display: flex; align-items: center; gap: 8px; padding: 20px 72px 8px; }
.rd-subj h2 { margin: 0; font: 400 22px/28px var(--font-hd); color: var(--text); }
.chip { background: #e8eaed; color: #3c4043; border-radius: 4px; font-size: 11px; line-height: 16px; padding: 1px 6px; white-space: nowrap; }
.rd-msg { padding: 0 72px; }
.rd-hd { display: flex; align-items: flex-start; gap: 16px; padding: 14px 0 12px; }
.rd-hd .av { width: 40px; height: 40px; font-size: 16px; }
.rd-who { flex: 1; min-width: 0; line-height: 20px; padding-top: 2px; }
.rd-name { font-weight: 700; color: var(--text); }
.rd-addr { color: var(--text3); font-size: 12px; margin-left: 4px; }
.rd-to { font-size: 12px; color: var(--text3); display: inline-flex; align-items: center; cursor: pointer; }
.rd-to svg { width: 16px; height: 16px; }
.rd-right { display: flex; align-items: center; font-size: 12px; color: var(--text3); }
.rd-date { margin-right: 8px; white-space: nowrap; }
.rd-body { padding: 4px 0 0 56px; font-size: 14px; line-height: 20px; color: var(--text); }
.rd-body iframe { width: 100%; border: 0; display: block; background: #fff; }
.rd-body pre { white-space: pre-wrap; word-break: break-word; font: 14px/20px var(--font); margin: 0; }
.rd-atts { padding: 20px 0 0 56px; border-top: 1px solid var(--border-lt); margin-top: 24px; }
.rd-atts-h { font-size: 12px; color: var(--text3); margin-bottom: 8px; }
.rd-atts-l { display: flex; flex-wrap: wrap; gap: 8px; }
.att { display: flex; align-items: center; gap: 10px; width: 180px; height: 56px; border: 1px solid var(--border); border-radius: 8px; padding: 0 12px; text-decoration: none; color: var(--text); }
.att:hover { background: #f0f4f9; }
.att svg { width: 22px; height: 22px; color: var(--blue); flex-shrink: 0; }
.att-t { min-width: 0; line-height: 16px; }
.att-t b { display: block; font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-t span { font-size: 11px; color: var(--text3); }
.rd-foot { padding: 28px 72px 0 128px; display: flex; gap: 8px; }
.pill { height: 36px; padding: 0 20px 0 16px; border-radius: 18px; border: 1px solid var(--outline); background: #fff; color: var(--text); font: 500 14px var(--font-hd); display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.pill:hover { background: #f0f4f9; }
.pill svg { width: 18px; height: 18px; }
.rd-inline { margin: 24px 72px 0 128px; border: 1px solid var(--border); border-radius: 8px; padding: 12px 16px; box-shadow: var(--sh1); }
.rd-inline-hd { display: flex; align-items: center; gap: 8px; color: var(--text2); padding-bottom: 8px; border-bottom: 1px solid var(--border-lt); min-height: 32px; }
.rd-inline-hd svg { width: 18px; height: 18px; }
.rd-inline-hd .to { border: 1px solid var(--border); border-radius: 16px; padding: 1px 10px; font-size: 13px; color: var(--text); }
.rd-inline-hd input { flex: 1; border: 0; outline: none; font: 14px var(--font); color: var(--text); }
.rd-inline textarea { width: 100%; min-height: 140px; border: 0; outline: none; resize: vertical; font: 14px/20px var(--font); color: var(--text); padding: 12px 0; display: block; }
.rd-inline-ft { display: flex; align-items: center; gap: 4px; padding-top: 8px; }
.btn-send { height: 36px; padding: 0 24px; border-radius: 18px; border: 0; background: var(--blue); color: #fff; font: 500 14px var(--font-hd); cursor: pointer; margin-right: 8px; }
.btn-send:hover { background: var(--blue-dk); box-shadow: var(--sh1); }
.btn-send:disabled { opacity: .5; cursor: default; }
.fn { font-size: 12px; color: var(--text3); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grow { flex: 1; }

/* ---------- fenêtre Nouveau message (flottante, bas droite) ---------- */
.cw { position: fixed; right: 64px; bottom: 0; width: 560px; height: 540px; max-height: calc(100vh - 80px); background: #fff; border-radius: 8px 8px 0 0; box-shadow: 0 8px 10px 1px rgba(0, 0, 0, .14), 0 3px 14px 2px rgba(0, 0, 0, .12), 0 5px 5px -3px rgba(0, 0, 0, .2); display: flex; flex-direction: column; z-index: 50; overflow: hidden; }
.cw.min { height: 40px; }
.cw.min > :not(.cw-hd) { display: none; }
.cw.full { right: 50%; bottom: 50%; transform: translate(50%, 50%); width: min(1000px, 92vw); height: min(760px, 90vh); max-height: none; border-radius: 8px; }
.cw-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .5); z-index: 49; }
.cw-hd { height: 40px; background: #f2f6fc; display: flex; align-items: center; padding: 0 8px 0 16px; font: 500 14px var(--font-hd); color: var(--text); flex-shrink: 0; cursor: pointer; gap: 2px; }
.cw-hd .ib { width: 32px; height: 32px; }
.cw-hd .ib svg { width: 18px; height: 18px; }
.cw-f { display: flex; align-items: center; height: 40px; margin: 0 16px; border-bottom: 1px solid #eceff1; gap: 8px; font-size: 14px; color: var(--text3); flex-shrink: 0; }
.cw-f input { flex: 1; min-width: 0; border: 0; outline: none; font: 14px var(--font); color: var(--text); height: 100%; }
.cw-f input::placeholder { color: var(--text3); }
.cw-cc { font-size: 13px; color: var(--text3); }
.cw-cc span { cursor: pointer; margin-left: 8px; }
.cw-cc span:hover { color: var(--text); text-decoration: underline; }
.cw textarea { flex: 1; border: 0; outline: none; resize: none; padding: 16px; font: 14px/20px var(--font); color: var(--text); min-height: 0; }
.cw-ft { display: flex; align-items: center; gap: 2px; padding: 8px 16px 16px; flex-shrink: 0; }
.cw-ft .btn-send { margin-right: 12px; }

/* ---------- menus, toast, login ---------- */
.menu { position: fixed; background: #fff; border-radius: 4px; box-shadow: var(--sh2); padding: 8px 0; min-width: 210px; max-width: 340px; z-index: 100; max-height: 70vh; overflow: auto; }
.menu-i { display: flex; align-items: center; gap: 12px; width: 100%; height: 36px; padding: 0 16px; border: 0; background: transparent; font: 14px var(--font); color: var(--text); cursor: pointer; text-align: left; white-space: nowrap; }
.menu-i:hover { background: #f0f4f9; }
.menu-i.on { font-weight: 700; }
.menu-i svg { width: 20px; height: 20px; color: var(--text2); flex-shrink: 0; }
.menu-i span { overflow: hidden; text-overflow: ellipsis; }
.menu-sep { height: 1px; background: var(--border); margin: 8px 0; }
.menu-head { padding: 6px 16px 4px; font-size: 11px; font-weight: 500; color: var(--text3); text-transform: uppercase; letter-spacing: .6px; }
.menu-acct { padding: 8px 16px 12px; display: flex; gap: 12px; align-items: center; }
.menu-acct .av { width: 40px; height: 40px; background: var(--blue); font-size: 16px; }
.menu-acct b { display: block; font-weight: 500; }
.menu-acct span { font-size: 12px; color: var(--text3); }
.toast { position: fixed; left: 24px; bottom: 24px; background: #202124; color: #fff; padding: 14px 24px; border-radius: 4px; font-size: 14px; box-shadow: var(--sh2); z-index: 200; animation: up .15s ease-out; }
@keyframes up { from { transform: translateY(8px); opacity: 0; } }

.login { min-height: 100vh; display: grid; place-items: center; background: var(--bg); padding: 16px; }
.login-card { width: min(450px, 100%); background: #fff; border-radius: 28px; padding: 48px 40px 40px; box-shadow: var(--sh1); }
.login-card .gm-logo { padding: 0; margin-bottom: 16px; font-size: 24px; }
.login-card h1 { font: 400 24px/32px var(--font-hd); margin: 0 0 4px; color: var(--text); }
.login-card p { margin: 0 0 28px; color: var(--text2); font-size: 16px; }
.fld { position: relative; margin-bottom: 20px; }
.fld input { width: 100%; height: 56px; border: 1px solid var(--outline); border-radius: 4px; padding: 0 15px; font: 16px var(--font); color: var(--text); outline: none; background: transparent; }
.fld input:focus { border: 2px solid var(--blue); padding: 0 14px; }
.fld label { position: absolute; left: 12px; top: -8px; background: #fff; padding: 0 4px; font-size: 12px; color: var(--text2); }
.fld input:focus + label { color: var(--blue); }
.login-err { color: #b3261e; font-size: 13px; min-height: 18px; margin: -8px 0 12px; }
.login-btn { float: right; height: 40px; padding: 0 24px; border-radius: 20px; border: 0; background: var(--blue); color: #fff; font: 500 14px var(--font-hd); cursor: pointer; }
.login-btn:hover { background: var(--blue-dk); box-shadow: var(--sh1); }

/* ---------- mobile ---------- */
@media (max-width: 800px) {
  .gm-top-l { width: auto; }
  .gm-logo-t, .gm-ws-t, .gm-top-r .ib.help, .gm-top-r .ib.settings { display: none; }
  .gm-nav { position: fixed; left: 0; top: 64px; bottom: 0; background: var(--bg); z-index: 40; transform: translateX(-100%); transition: transform .2s; width: 256px !important; }
  .gm.navopen .gm-nav { transform: none; box-shadow: var(--sh2); }
  .gm.collapsed .gm-compose span, .gm.collapsed .nav-i .lb, .gm.collapsed .nav-i .ct, .gm.collapsed .gm-labels-h span { display: initial; }
  .gm.collapsed .gm-compose { width: fit-content; padding: 0 24px 0 16px; gap: 16px; }
  .gm-main { margin: 0; border-radius: 0; }
  .row { height: auto; flex-wrap: wrap; padding: 8px 12px 8px 4px; row-gap: 2px; }
  .row-l { width: auto; order: 0; }
  .row-from { order: 1; flex: 1; width: auto; }
  .row-date { order: 2; width: auto; }
  .row-subj { order: 3; width: 100%; flex: none; padding-left: 68px; font-weight: 400; }
  .row.unread .row-subj .s { font-weight: 700; }
  .row-att { order: 2; }
  .row:hover .row-date { visibility: visible; }
  .row:hover .row-acts { display: none; }
  .rd-subj, .rd-msg { padding-left: 16px; padding-right: 16px; }
  .rd-body, .rd-atts { padding-left: 0; }
  .rd-foot { padding: 24px 16px 0; }
  .rd-inline { margin: 24px 16px 0; }
  .cw, .cw.full { right: 0; left: 0; bottom: 0; width: 100%; height: 100vh; max-height: none; border-radius: 0; transform: none; }
}
