* { box-sizing: border-box; }
:root {
  --bg: #f6e8cc; --paper: #fff3df; --text: #17354a; --muted: #526172;
  --line: #c5b393; --active: #17354a; --on-active: #fff5e2; --select: #e9dfcd;
  --heading: Georgia, serif; --cover: url(studio.webp);
  color-scheme: light;
}
:root[data-theme=feld] {
  --bg: #14221e; --paper: #1f302a; --text: #edf4ed; --muted: #b7c6bd;
  --line: #51625a; --active: #a8c6a4; --on-active: #14221e; --select: #374d41;
  --heading: system-ui, sans-serif; --cover: none; color-scheme: dark;
}
body { margin: 0 auto; max-width: 1560px; min-height: 100dvh; display: flex; flex-direction: column; background: var(--bg); color: var(--text); font: 1rem system-ui, sans-serif; }
body::before { content: ""; position: fixed; inset: auto 0 0; height: 24vh; background: linear-gradient(var(--bg), transparent), var(--cover) center bottom / cover; opacity: .35; z-index: -1; }
header, footer { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem clamp(1rem, 3vw, 2.5rem); }
header { border-bottom: 1px solid var(--line); }
.brand { flex: 0 0 auto; width: 250px; height: 76px; background: var(--cover) 50% 13.6% / 330% auto; border-radius: 19px; }
.brand span { display: none; }
[data-theme=feld] .brand { display: grid; place-items: center; height: 55px; width: 206px; background: linear-gradient(160deg,#f1f3f1,#a8b2af 60%,#e5eae7); color: #15231e; border: 1px solid #c5cdca; border-radius: 8px; box-shadow: 0 4px 10px #10181480; }
[data-theme=feld] .brand span { display: block; text-align: center; letter-spacing: .22em; font-weight: 750; }
.brand small { display: block; letter-spacing: .3em; }
.tools, .actions, #accounts { display: flex; gap: .45rem; align-items: center; }
button, input, select, textarea { font: inherit; color: inherit; border: 1px solid var(--line); border-radius: .45rem; background: var(--paper); padding: .55rem .75rem; min-height: 44px; }
button { cursor: pointer; }
button:hover, .message[aria-current=true] { background: var(--select); }
button.primary, button[aria-pressed=true] { background: var(--active); color: var(--on-active); }
:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
main { display: grid; grid-template-columns: minmax(175px, .65fr) minmax(250px, 1.15fr) minmax(290px, 1.6fr); margin: 1rem clamp(1rem, 3vw, 2.5rem); min-height: 65vh; background: var(--paper); overflow: hidden; border: 1px solid var(--line); border-radius: .75rem; }
nav, #reader, .list-header { padding: 1rem; }
nav { display: flex; gap: .45rem; flex-direction: column; border-right: 1px solid var(--line); }
nav button { text-align: left; }
#inbox, #reader { min-width: 0; }
#reader { border-left: 1px solid var(--line); }
h1, h2 { font-family: var(--heading); margin: 0 0 .75rem; }
h1 { font-size: 1.45rem; }
.message { width: 100%; border: 0; border-top: 1px solid var(--line); border-radius: 0; display: grid; grid-template-columns: minmax(0,1fr) auto; text-align: left; gap: .2rem; padding: .8rem 1rem; }
.message strong, .excerpt { grid-column: 1 / -1; }
.excerpt, .sender { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.message.unread .sender::before { content: "● "; }
time, .excerpt, .meta, footer, .empty { color: var(--muted); font-size: .875rem; }
#reader .content { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; margin: 1.25rem 0; }
#reader .actions { flex-wrap: wrap; }
.close-reader { display: none; }
.empty { margin: 1rem; }
footer { margin-top: auto; }
footer button { display: none; }
dialog { width: min(92vw, 480px); color: var(--text); background: var(--paper); border: 1px solid var(--line); border-radius: .8rem; padding: 1.35rem; }
dialog::backdrop { background: #0008; }
dialog form { display: grid; gap: .6rem; }
@media (max-width: 740px) {
  header { flex-wrap: wrap; padding: .65rem .9rem; }
  .brand { margin: auto; }
  .tools { width: 100%; }
  .tools input { flex: 1; min-width: 0; }
  main { display: flex; flex-direction: column; min-height: 0; margin: .65rem; }
  nav { padding: .5rem; flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  nav button { white-space: nowrap; }
  #folders .compose, #reader { display: none; }
  main.reading nav, main.reading #inbox { display: none; }
  main.reading #reader, .close-reader, footer button { display: block; }
  #reader { border-left: 0; }
  .close-reader { margin-bottom: 1rem; }
}
/* Studio familial */
[data-theme=studio] body { max-width: none; }
[data-theme=studio] header { position: relative; min-height: 143px; padding-block: 1.15rem; }
[data-theme=studio] header::before {
  content: "MAIL EHRENFELD"; font: 1.05rem Georgia, serif; letter-spacing: .27em; color: var(--text);
}
[data-theme=studio] .brand { width: 340px; height: 105px; position: absolute; left: 50%; transform: translateX(-50%); }
[data-theme=studio] .tools input { width: min(23vw, 350px); }
[data-theme=studio] main {
  grid-template-columns: minmax(200px, .7fr) minmax(290px, 1.05fr) minmax(350px, 1.55fr);
  min-height: 68vh; background: #fff3dfdd; border-radius: .55rem; 
}
[data-theme=studio] body::before { height: clamp(145px, 26vh, 300px); opacity: .62; background-size: 100% auto; }
[data-theme=studio] #folders { gap: .22rem; }
[data-theme=studio] #folders button:not(.compose) { border-color: transparent; background: transparent; }
[data-theme=studio] #folders button:hover, [data-theme=studio] #folders button[aria-pressed=true] {
  background: var(--select); color: var(--text); 
}
[data-theme=studio] #folders button::before { display: inline-block; width: 1.65rem; }
[data-theme=studio] #folders .compose::before { content: "✎"; }
[data-theme=studio] [data-folder=inbox]::before { content: "✉"; }
[data-theme=studio] [data-folder=starred]::before { content: "☆"; }
[data-theme=studio] [data-folder=drafts]::before { content: "▤"; }
[data-theme=studio] [data-folder=trash]::before { content: "♲"; }
[data-theme=studio] .list-header, [data-theme=studio] #reader { padding: clamp(1rem, 2vw, 1.75rem); }
[data-theme=studio] #title, [data-theme=studio] #reader h2 { font-size: clamp(1.55rem, 2.2vw, 2.2rem); }
[data-theme=studio] .message { background: transparent; padding-inline: clamp(1rem, 2vw, 1.75rem); }
[data-theme=studio] .message:hover, [data-theme=studio] .message[aria-current=true] { background: #dfe5e3; }
[data-theme=studio] .message strong { font-family: Georgia, serif; font-size: 1.1rem; }
[data-theme=studio] #reader .content { font-family: Georgia, serif; font-size: 1.12rem; }
@media (max-width: 1050px) {
  [data-theme=studio] header::before { font-size: .85rem; }
  [data-theme=studio] .brand { width: 250px; height: 76px; }
  [data-theme=studio] main { grid-template-columns: 170px minmax(230px, 1fr) minmax(260px, 1.3fr); }
}
@media (max-width: 740px) {
  [data-theme=studio] header { justify-content: center; flex-direction: column; gap: .65rem; padding: .75rem .9rem; }
  [data-theme=studio] .brand { position: static; transform: none; width: 250px; height: 76px; }
  [data-theme=studio] .tools input { width: auto; }
  [data-theme=studio] main { min-height: 0; }
  [data-theme=studio] #folders button::before { display: none; }
  [data-theme=studio] body::before { background-size: auto 100%; }
}

#studio-profile, .studio-rule, #studio-tabs, #studio-accounts, #message-count { display: none; }
.reader-identity { display: flex; gap: .65rem; align-items: center; }
.reader-identity > :last-child { margin-left: auto; }
.identity-details { min-width: 0; overflow-wrap: anywhere; }
.identity-details span { display: block; }
.avatar { display: grid; place-items: center; width: 2.35rem; height: 2.35rem; flex: 0 0 auto; border-radius: 50%; background: var(--select); }
@media (min-width: 901px) {
  [data-theme=studio] body {
    border: 5px solid #17354a; border-radius: 13px; padding: 0 clamp(18px, 2vw, 38px);
    font-family: Georgia, serif; position: relative; isolation: isolate;
    background: radial-gradient(ellipse at 50% 8%, #fff3df 10%, #f6e8cc 82%);
  }
  [data-theme=studio] body::before {
    inset: auto 0 0; position: absolute; height: clamp(125px, 23vh, 265px);
    opacity: .84; border-radius: 0 0 8px 8px;
    background-image: linear-gradient(#f6e8cc 0%, transparent 45%), url(studio.webp);
  }
  [data-theme=studio] header {
    display: grid; grid-template-columns: 1fr auto 1fr; grid-template-rows: auto auto auto;
    min-height: 0; align-items: center; padding: clamp(14px, 2vh, 25px) 0 0; gap: .45rem 0;
  }
  [data-theme=studio] header::before { letter-spacing: clamp(.1em, .24vw, .27em); color: #0b2940; }
  [data-theme=studio] .brand {
    position: static; transform: none; width: clamp(255px, 28vw, 490px);
    height: auto; aspect-ratio: 3.25; filter: drop-shadow(0 3px 2px #493a2330);
  }
  [data-theme=studio] #studio-profile { display: block; justify-self: end; background: transparent; border-color: transparent; }
  [data-theme=studio] .studio-rule { display: flex; grid-column: 1 / -1; gap: .55rem; align-items: center; color: #9b711f; line-height: 1; }
  .studio-rule::before, .studio-rule::after { content: ""; flex: 1; border-top: 1px solid #a87b31; }
  .studio-rule span { font-size: 1.35rem; }
  [data-theme=studio] .tools { grid-column: 1 / -1; padding: 0 0 .45rem; }
  [data-theme=studio] #studio-tabs { display: flex; flex-direction: row; border: 0; padding: 0; margin-right: auto; }
  [data-theme=studio] #studio-tabs button { border-color: transparent; min-height: 36px; background: transparent; }
  [data-theme=studio] #studio-tabs button:hover { background: var(--select); }
  [data-theme=studio] #studio-tabs button[aria-pressed=true] { background: #103b55; }
  [data-theme=studio] #settings { display: none; }
  [data-theme=studio] .tools input { min-height: 36px; width: clamp(225px, 27vw, 480px); border-color: #8c9a9d; background: #fff7e95e; }
  [data-theme=studio] main {
    grid-template-columns: minmax(174px, 21fr) minmax(285px, 34fr) minmax(330px, 45fr);
    border: 0; border-radius: 0; background: transparent; margin: 0 0 clamp(70px, 12vh, 170px); min-height: 0;
  }
  [data-theme=studio] #folders { padding: .9rem .9rem 1rem 0; }
  [data-theme=studio] #folders button { min-height: 36px; }
  [data-theme=studio] #folders .compose { margin-bottom: .55rem; background: #103b55; color: white; }
  [data-theme=studio] #studio-accounts { display: grid; border-top: 1px solid #b49558; margin-top: .65rem; padding: .65rem 0; }
  [data-theme=studio] #studio-accounts h2 { text-transform: uppercase; letter-spacing: .18em; font-size: .8rem; margin: .3rem .75rem; }
  [data-theme=studio] #studio-accounts button::before { display: none; }
  [data-theme=studio] .list-header, [data-theme=studio] #reader { padding: .8rem clamp(.75rem, 1.4vw, 1.6rem); }
  [data-theme=studio] .list-title { display: flex; align-items: baseline; gap: .55rem; justify-content: space-between; }
  [data-theme=studio] #message-count { display: block; font-style: italic; font-size: .9rem; white-space: nowrap; }
  [data-theme=studio] #title, [data-theme=studio] #reader h2 { font-size: clamp(1.45rem, 2vw, 2rem); margin-bottom: .55rem; }
  [data-theme=studio] #accounts button { min-height: 32px; padding: .2rem .55rem; font-size: .85rem; }
  [data-theme=studio] #messages { padding: 0 clamp(.5rem, .9vw, 1rem) 1rem; }
  [data-theme=studio] .message { padding: .55rem .72rem .55rem 1.65rem; gap: .1rem; position: relative; }
  [data-theme=studio] .message[aria-current=true] { border-radius: .45rem; background: #dce3e6; }
  [data-theme=studio] .message .sender { font-size: 1.07rem; font-weight: 700; }
  [data-theme=studio] .message.unread .sender::before { position: absolute; left: .45rem; top: .65rem; font-size: .8rem; }
  [data-theme=studio] .message strong { font-size: 1rem; font-weight: 500; }
  [data-theme=studio] .reader-identity { border-bottom: 1px solid #b49558; padding: .5rem 0 .75rem; }
  [data-theme=studio] .avatar { background: #e8d2a9; }
  [data-theme=studio] footer { padding-inline: 0; }
}

[hidden] { display: none !important; }
#signin { padding: 1rem; }
#login { display: grid; gap: .65rem; max-width: 385px; margin: 1rem auto; border: 1px solid var(--line); background: var(--paper); padding: 1.35rem; border-radius: .7rem; }
#login button { margin-top: .45rem; }

/* Panorama fixe Studio familial */
@media (min-width: 901px) {
  [data-theme=studio] body::before {
    position: fixed;
    inset: auto 5px 5px;
    pointer-events: none;
  }
}

#mail-folders { border-top: 1px solid var(--line); margin-top: .6rem; padding: .55rem 0; }
#mail-folders summary { cursor: pointer; font-family: var(--heading); padding: .35rem .7rem; }
#mail-folder-list { display: grid; }
#mail-folder-list button { overflow-wrap: anywhere; }
#mail-folder-list button::before { content: "▱"; }
#mail-folder-list .meta { margin: .4rem .7rem; }
[data-theme=studio] [data-folder=sent]::before { content: "➤"; }
@media (min-width: 901px) {
  [data-theme=studio] #mail-folders summary { font-size: .78rem; letter-spacing: .17em; text-transform: uppercase; }
}
@media (max-width: 740px) {
  #mail-folders { min-width: max-content; margin-top: 0; padding: 0 .5rem; border-top: 0; }
  #mail-folders summary { min-height: 44px; display: list-item; padding-block: .75rem; }
}

#folders label[for=account-picker] { font-size: .875rem; padding-inline: .35rem; }
#account-picker { min-width: 0; max-width: 100%; }
#send-from { margin: 0; color: var(--muted); overflow-wrap: anywhere; }
@media (max-width: 740px) {
  #folders label[for=account-picker] { align-self: center; }
  #account-picker { min-width: min(250px, 62vw); }
}

/* Navigation PWA téléphone */
#mobile-nav { display: none; }
@media (max-width: 740px) {
  #workspace #folders { display: none; }
  #workspace.mobile-folders-open #folders {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
    border-bottom: 1px solid var(--line); gap: .45rem; padding: .75rem;
  }
  #folders label[for=account-picker], #account-picker, #mail-folders { grid-column: 1 / -1; }
  #workspace.mobile-folders-open #folders button { white-space: normal; }
  #workspace #mail-folders { min-width: 0; }
  #mobile-nav {
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .35rem;
    position: fixed; inset: auto 0 0; z-index: 5;
    padding: .45rem max(.55rem, env(safe-area-inset-right)) calc(.45rem + env(safe-area-inset-bottom)) max(.55rem, env(safe-area-inset-left));
    background: var(--paper); border-top: 1px solid var(--line);
  }
  #mobile-nav button { padding-inline: .2rem; font-size: .86rem; }
  body:has(#mobile-nav:not([hidden])) footer { padding-bottom: calc(4rem + env(safe-area-inset-bottom)); }
}

/* Pièces jointes reçues */
.mail-attachments { border-top: 1px solid var(--line); padding-top: .8rem; margin: 1rem 0; }
.mail-attachments h3 { margin: 0 0 .45rem; font-size: 1rem; }
.mail-attachments ul { margin: 0; padding: 0; list-style: none; display: grid; gap: .4rem; }
.mail-attachments a { display: flex; align-items: center; min-height: 44px; padding: .55rem .7rem; background: var(--paper); color: var(--text); border: 1px solid var(--line); border-radius: .45rem; overflow-wrap: anywhere; }

/* Rédaction : contacts et fichiers */
#editor { max-height: 90dvh; overflow: auto; }
#editor input, #editor textarea, #editor select { min-width: 0; width: 100%; }
.recipient-controls { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .45rem; }
.recipient-controls:has(#pick-contact[hidden]) { grid-template-columns: minmax(0, 1fr); }
#outgoing-list { margin: 0; padding-left: 1.35rem; overflow-wrap: anywhere; }
#files-limit { color: var(--muted); }

/* Marge de la navigation Android */
@media (max-width: 740px) {
  #mobile-nav { padding-bottom: calc(.95rem + env(safe-area-inset-bottom)); }
  body:has(#mobile-nav:not([hidden])) footer { padding-bottom: calc(4.5rem + env(safe-area-inset-bottom)); }
}

/* Message HTML original */
.mail-original { display: block; width: 100%; height: clamp(320px, 62dvh, 850px); margin: .55rem 0 1rem; border: 1px solid var(--line); border-radius: .45rem; background: #fff; }
.mail-view-toggle { margin-top: .65rem; }

/* Lecture intégrée du message */
#reader .mail-original {
  border: 0; border-radius: 0; height: 320px;
  max-height: none; margin: .5rem 0 1rem;
}
@media (max-width: 740px) {
  #workspace.reading #reader { padding: .65rem 0; }
  #workspace.reading #reader > :not(.mail-original) {
    margin-left: .75rem; margin-right: .75rem;
  }
  #workspace.reading #reader > h2 {
    font-family: inherit; font-size: 1rem;
    line-height: 1.35; margin-bottom: .4rem;
  }
  #workspace.reading #reader > .reader-identity {
    font-size: .85rem; overflow-wrap: anywhere;
    margin-top: .35rem; margin-bottom: .65rem;
  }
  #workspace.reading .close-reader {
    margin-bottom: .6rem; padding: .35rem .6rem;
  }
}

/* Carnet de correspondance — local fonts, vector engravings and Port-Bail. */
@font-face { font-family: 'Mail Parisienne'; src: url('/parisienne.woff') format('woff'); font-style: normal; font-weight: 400; font-display: swap; }
@font-face { font-family: 'Mail Garamond'; src: url('/garamond.woff') format('woff'); font-style: normal; font-weight: 400; font-display: swap; }
.mail-symbols { position:absolute; width:0; height:0; overflow:hidden; pointer-events:none; }
.mail-icon { width:1.65rem; height:1.65rem; flex:none; vertical-align:middle; display:inline-block; pointer-events:none; }
.plaque-glints, .search-engraving { display:none; }
[data-theme=studio] { --bg:#fcf0db; --paper:#fff4e1; --text:#112e46; --muted:#3d5870; --line:#ba9555; --active:#153950; --on-active:#fff1d6; --heading:'Mail Garamond',Georgia,serif; }
[data-theme=studio] body {
  max-width:none; padding:0 clamp(16px,2vw,36px); border:0; border-radius:0;
  font-family:'Mail Garamond',Georgia,serif; background:#fcf0db;
  isolation:isolate; position:relative; color:var(--text);
}
[data-theme=studio] body::before {
  content:''; position:fixed; inset:0; height:auto; z-index:-1; border-radius:0;
  pointer-events:none; opacity:1;
  background:linear-gradient(to bottom,rgba(255,246,229,.92),rgba(255,246,229,.54) 36%,rgba(255,246,229,.16) 76%),url('/portbail-wide.webp') center bottom / cover no-repeat;
}
[data-theme=studio] header { padding:1rem 0 .5rem; border:0; min-height:0; gap:.5rem; }
[data-theme=studio] header::before { font-family:'Mail Garamond',Georgia,serif; letter-spacing:.25em; font-size:1.05rem; }
[data-theme=studio] .brand { width:clamp(340px,36vw,610px); height:auto; aspect-ratio:3.25; border-radius:0; position:relative; left:auto; transform:none; background-size:330% auto; filter:drop-shadow(0 3px 2px #493a2328); }
[data-theme=studio] #studio-profile { display:none; }
[data-theme=studio] .brand .plaque-glints { display:block; position:absolute; inset:0; overflow:hidden; border-radius:25%; pointer-events:none; }
.plaque-glints i { position:absolute; top:35%; width:8px; height:8px; background:radial-gradient(ellipse,#fff 0 10%,#ffe7aa 22%,transparent 65%); opacity:0; animation:mail-letter-glint 10s ease-in-out infinite; }
.plaque-glints i::before,.plaque-glints i::after { content:''; position:absolute; background:linear-gradient(transparent,#fff9df,transparent); inset:-4px 3px; }
.plaque-glints i::after { transform:rotate(90deg); }
.plaque-glints i:nth-child(1) { left:28%; animation-delay:0s; }
.plaque-glints i:nth-child(2) { left:34%; animation-delay:.65s; }
.plaque-glints i:nth-child(3) { left:40%; animation-delay:1.3s; }
.plaque-glints i:nth-child(4) { left:46%; animation-delay:1.95s; }
.plaque-glints i:nth-child(5) { left:52%; animation-delay:2.6s; }
.plaque-glints i:nth-child(6) { left:58%; animation-delay:3.25s; }
.plaque-glints i:nth-child(7) { left:64%; animation-delay:3.9s; }
.plaque-glints i:nth-child(8) { left:70%; animation-delay:4.55s; }
.plaque-glints i:nth-child(9) { left:77%; animation-delay:5.2s; }
@keyframes mail-letter-glint { 0%,12%,100% { opacity:0; transform:scale(.4); } 5% { opacity:.98; transform:scale(1.25); } }
[data-theme=studio] .studio-rule { margin:.1rem 0 .45rem; }
[data-theme=studio] .tools { position:relative; gap:.5rem; }
[data-theme=studio] #studio-tabs { gap:.25rem; }
[data-theme=studio] #studio-tabs button { display:flex; align-items:center; gap:.35rem; font-size:1rem; min-height:44px; border-radius:.5rem; }
[data-theme=studio] #studio-tabs button[aria-pressed=true] { background:var(--active); color:var(--on-active); --icon-ink:#f5d38b; --icon-paper:#153950; }
[data-theme=studio] #search { background:#fff4e16b; border-color:#ba9555; border-radius:1.4rem; font-family:'Mail Garamond',Georgia,serif; font-style:italic; font-size:1.12rem; min-height:44px; }
[data-theme=studio] main { background:transparent; margin:0 0 9vh; border:0; border-radius:0; min-height:68vh; }
[data-theme=studio] #inbox { background:rgba(255,246,229,.43); border-inline:1px solid #b8915045; border-radius:.7rem .7rem 0 0; }
[data-theme=studio] .list-header { padding:1.1rem 1.3rem .55rem; background:transparent; }
[data-theme=studio] #title { font:400 clamp(2.35rem,3.3vw,3.35rem)/1.15 'Mail Parisienne',cursive; margin:0; padding:.15rem 0; }
[data-theme=studio] #message-count { display:block; font:italic 1rem 'Mail Garamond',Georgia,serif; white-space:nowrap; }
[data-theme=studio] .selection-tools { border:0; padding:.5rem 1.3rem 1rem; background:transparent; }
[data-theme=studio] .selection-tools button { border-color:#b58b41; background:#fff4e15c; font-family:'Mail Garamond',Georgia,serif; min-height:42px; font-size:.95rem; border-radius:.55rem; }
[data-theme=studio] .selection-tools > button:first-child { text-transform:uppercase; letter-spacing:.065em; padding-inline:1rem; box-shadow:inset 0 0 0 2px #fff4e1,inset 0 0 0 3px #c9a971; }
[data-theme=studio] #messages { padding:0 1rem 1rem; }
[data-theme=studio] .message-row { border-top:1px solid #b68b3d; background:transparent; }
[data-theme=studio] .message { padding:.85rem .3rem .9rem .4rem; gap:.12rem .4rem; background:transparent; }
[data-theme=studio] .message:hover, [data-theme=studio] .message[aria-current=true] { background:#fff6e594; }
[data-theme=studio] .message .sender { font:400 clamp(1.8rem,2.3vw,2.45rem)/1.2 'Mail Parisienne',cursive; color:var(--text); padding:.1rem 0; }
[data-theme=studio] .message.unread .sender::before { position:static; content:'• '; color:#a77d2d; font:1rem Georgia,serif; }
[data-theme=studio] .message strong { font:400 clamp(1.1rem,1.35vw,1.35rem)/1.25 'Mail Garamond',Georgia,serif; }
[data-theme=studio] .message.unread strong { font-weight:600; }
[data-theme=studio] .message time, [data-theme=studio] .folder-label { font-family:system-ui,sans-serif; font-size:.72rem; color:#304d65; }
[data-theme=studio] .message time { align-self:center; }
[data-theme=studio] .message-star { color:var(--text); font-size:1.6rem; background:transparent; }
[data-theme=studio] .message-star[aria-pressed=true] { color:#9c7023; }
[data-theme=studio] #folders { border-color:#b891505c; background:#fff4e12b; padding:1rem .8rem 1rem 0; }
[data-theme=studio] #folders button { display:flex; gap:.6rem; align-items:center; text-align:left; font:1.06rem 'Mail Garamond',Georgia,serif; }
[data-theme=studio] #folders button::before { display:none; }
[data-theme=studio] #folders .compose { background:var(--active); --icon-ink:#f5d38b; --icon-paper:#153950; }
[data-theme=studio] #mail-folder-list button { gap:.5rem; }
[data-theme=studio] #mail-folder-list .mail-icon { width:1.35rem; height:1.35rem; }
[data-theme=studio] #mail-folders summary { letter-spacing:.08em; font-size:.95rem; }
[data-theme=studio] #mail-folders summary .mail-icon { margin-right:.4rem; }
[data-theme=studio] #reader { background:#fff6e5b5; border-color:#b891505c; }
[data-theme=studio] #reader h2 { font-family:'Mail Garamond',Georgia,serif; }
[data-theme=studio] #reader .content { font-family:'Mail Garamond',Georgia,serif; font-size:1.2rem; }
[data-theme=studio] dialog { background:#fff3df; border-color:#b58b41; box-shadow:0 12px 50px #17354a24; }
[data-theme=studio] dialog h2, [data-theme=studio] #login h1 { font-family:'Mail Parisienne',cursive; font-weight:400; font-size:2.3rem; }
[data-theme=studio] dialog input, [data-theme=studio] dialog textarea, [data-theme=studio] #login input { font-family:system-ui,sans-serif; }
@media (min-width:741px) and (max-width:1100px) {
  [data-theme=studio] main { grid-template-columns:185px minmax(300px,1fr); }
  [data-theme=studio] #reader:empty { display:none; }
  [data-theme=studio] main.reading { grid-template-columns:185px minmax(300px,1fr); }
  [data-theme=studio] main.reading #inbox { display:none; }
}
@media (max-width:740px) {
  [data-theme=studio] body { padding:0; }
  [data-theme=studio] body::before { background-image:linear-gradient(to bottom,#fff4e1cc,#fff4e177 42%,#fff4e11a 80%),url('/portbail-mobile.webp'); background-position:center bottom; background-size:cover; }
  [data-theme=studio] header { display:flex; flex-direction:column; padding:.85rem .6rem .8rem; gap:.75rem; }
  [data-theme=studio] header::before { font-size:.95rem; letter-spacing:.28em; }
  [data-theme=studio] .brand { width:100%; max-width:620px; aspect-ratio:3.25; height:auto; position:relative; background-size:330% auto; border-radius:0; }
  [data-theme=studio] .studio-rule, [data-theme=studio] #studio-tabs { display:none; }
  [data-theme=studio] .tools { width:100%; display:flex; padding:0 .25rem; }
  [data-theme=studio] .tools #search { width:100%; flex:1; min-width:0; min-height:48px; padding-left:3rem; font-size:1.12rem; }
  [data-theme=studio] .search-engraving { display:block; position:absolute; left:1rem; top:50%; transform:translateY(-50%); pointer-events:none; }
  [data-theme=studio] .search-engraving .mail-icon { width:1.7rem; height:1.7rem; }
  [data-theme=studio] #settings { display:none; }
  [data-theme=studio] body:has(#workspace[hidden]) #settings { display:flex; align-items:center; gap:.3rem; }
  [data-theme=studio] body:has(#workspace[hidden]) #settings span { display:none; }
  [data-theme=studio] main { display:flex; min-height:0; margin:.25rem .55rem 1rem; overflow:hidden; background:transparent; }
  [data-theme=studio] #inbox { border:0; background:#fff4e14f; }
  [data-theme=studio] .list-header { padding:1rem .8rem .4rem; }
  [data-theme=studio] .list-title { display:flex; align-items:baseline; justify-content:space-between; gap:.3rem; }
  [data-theme=studio] #title { font-size:clamp(2.1rem,8.5vw,3.2rem); }
  [data-theme=studio] #message-count { font-size:.82rem; }
  [data-theme=studio] .selection-tools { padding:.5rem .8rem .9rem; }
  [data-theme=studio] #messages { padding:0 .65rem 1rem; }
  [data-theme=studio] .message { padding:.65rem .1rem .7rem; gap:.1rem .3rem; }
  [data-theme=studio] .message .sender { font-size:clamp(1.85rem,7.2vw,2.5rem); line-height:1.22; }
  [data-theme=studio] .message strong { font-size:1.17rem; line-height:1.22; }
  [data-theme=studio] .message time { font-size:.72rem; }
  [data-theme=studio] .folder-label { font-size:.73rem; overflow-wrap:anywhere; }
  [data-theme=studio] #mobile-nav { gap:.25rem; padding:.4rem .4rem calc(.4rem + env(safe-area-inset-bottom)); border-color:#b58b41; background:#fff1dce8; backdrop-filter:blur(8px); }
  [data-theme=studio] #mobile-nav button { display:flex; flex-direction:column; justify-content:center; align-items:center; gap:.1rem; min-height:74px; min-width:0; padding:.3rem .05rem; border-radius:.9rem; border-color:#b99a67; font:600 clamp(.75rem,3vw,.95rem) 'Mail Garamond',Georgia,serif; text-transform:uppercase; letter-spacing:.035em; background:#fff6e36b; color:var(--text); }
  [data-theme=studio] #mobile-nav .mail-icon { width:2.45rem; height:2.45rem; }
  [data-theme=studio] body:not(:has(#workspace.mobile-folders-open)) #mobile-messages,
  [data-theme=studio] body:has(#workspace.mobile-folders-open) #mobile-folders,
  [data-theme=studio] body:has(#appearance[open]) #mobile-settings { background:var(--active); color:var(--on-active); border-color:#b88730; --icon-ink:#f6d89d; --icon-paper:#153950; }
  [data-theme=studio] body:has(#mobile-nav:not([hidden])) footer { padding-bottom:calc(100px + env(safe-area-inset-bottom)); }
  [data-theme=studio] #workspace.mobile-folders-open #folders { padding:.7rem; background:#fff4e1e8; }
  [data-theme=studio] #folders button { font-size:1rem; }
  [data-theme=studio] #reader { padding:.7rem .2rem; }
}
@media (prefers-reduced-motion:reduce) { .plaque-glints i { animation:none; } }

/* Lisibilité : conserver le paysage sans gêner la lecture. */
[data-theme=studio] #inbox { background:rgba(255,246,229,.80); }
[data-theme=studio] #folders { background:rgba(255,246,229,.87); }
[data-theme=studio] #reader { background:rgba(255,246,229,.90); }
[data-theme=studio] .message-row:has(.message.unread) {
  background:rgba(255,248,233,.72);
  box-shadow:inset 3px 0 0 #17354a;
}
[data-theme=studio] .message.unread .sender::before {
  content:'● '; color:#17354a; font:700 .9rem system-ui,sans-serif;
}
[data-theme=studio] .message.unread strong { font-weight:700; color:#102e45; }
[data-theme=studio] .message time {
  display:flex; flex-direction:column; align-items:flex-end; gap:.3rem;
}
[data-theme=studio] .message.unread time::after {
  content:'Non lu'; display:block; padding:.18rem .4rem;
  border-radius:.3rem; background:#17354a; color:#fff6e5;
  font:600 .625rem/1.2 system-ui,sans-serif; letter-spacing:.035em;
  white-space:nowrap; text-transform:uppercase;
}
@media (max-width:740px) {
  [data-theme=studio] #inbox { background:rgba(255,246,229,.80); }
  [data-theme=studio] #workspace.mobile-folders-open #folders { background:rgba(255,246,229,.91); }
}

/* Transparence intermédiaire, repères des messages non lus conservés. */
[data-theme=studio] #inbox { background:rgba(255,246,229,.72); }
[data-theme=studio] #folders { background:rgba(255,246,229,.80); }
[data-theme=studio] #reader { background:rgba(255,246,229,.85); }
@media (max-width:740px) {
  [data-theme=studio] #inbox { background:rgba(255,246,229,.72); }
  [data-theme=studio] #workspace.mobile-folders-open #folders { background:rgba(255,246,229,.84); }
}

/* PC : placer les arches sous la plaque, sans déplacer le voile de lisibilité. */
@media (min-width:741px) {
  [data-theme=studio] body::before {
    background-position:center bottom,center calc(100% + clamp(180px,22vh,260px));
  }
}

/* PC : dégager aussi le sommet du clocher sous la plaque. */
@media (min-width:741px) {
  [data-theme=studio] body::before {
    background-position:center bottom,center calc(100% + clamp(280px,32vh,360px));
  }
}

/* Panneaux transparents, séparations et états conservés. */
[data-theme=studio] #inbox,
[data-theme=studio] #folders,
[data-theme=studio] #reader,
[data-theme=studio] .list-header,
[data-theme=studio] .selection-tools,
[data-theme=studio] .message-row,
[data-theme=studio] .message-row:has(.message.unread),
[data-theme=studio] .message-row > .message,
[data-theme=studio] .message-row > .select-message,
[data-theme=studio] .message-row > .message-star { background:transparent; }
[data-theme=studio] #inbox { border-inline:1px solid #a97d3e80; }
[data-theme=studio] #folders, [data-theme=studio] #reader { border-color:#a97d3e80; }
[data-theme=studio] .message-row { border-top:1px solid #ad7f35; }
[data-theme=studio] .message-row:last-child { border-bottom:1px solid #ad7f35; }
[data-theme=studio] .message:hover,
[data-theme=studio] .message[aria-current=true] { background:rgba(255,246,229,.22); }
[data-theme=studio] #studio-tabs button,
[data-theme=studio] #folders button:not(.compose) {
  background:transparent; border:1px solid #a97d3e66;
  --icon-ink:#17354a; --icon-paper:rgba(255,246,229,.25);
}
[data-theme=studio] #studio-tabs button[aria-pressed=true],
[data-theme=studio] #folders button[aria-pressed=true]:not(.compose) {
  color:#17354a; background:rgba(196,152,72,.14);
  border-color:#9b702e; box-shadow:inset 0 -2px 0 #9b702e;
  --icon-ink:#17354a; --icon-paper:rgba(255,246,229,.25);
}
[data-theme=studio] .message-row:has(.select-message input:checked) { background:rgba(196,152,72,.24); }
[data-theme=studio] .message-row.mail-swiping > .message { background:var(--paper); }
@media (max-width:740px) {
  [data-theme=studio] #workspace.mobile-folders-open #folders { background:transparent; }
  [data-theme=studio] #mobile-nav { background:rgba(255,246,229,.24); }
  [data-theme=studio] #mobile-nav button { background:transparent; border-color:#a97d3e; --icon-ink:#17354a; --icon-paper:rgba(255,246,229,.25); }
  [data-theme=studio] body:not(:has(#workspace.mobile-folders-open)) #mobile-messages,
  [data-theme=studio] body:has(#workspace.mobile-folders-open) #mobile-folders,
  [data-theme=studio] body:has(#appearance[open]) #mobile-settings {
    background:rgba(196,152,72,.18); color:#17354a; border-color:#9b702e;
    box-shadow:inset 0 -2px 0 #9b702e; --icon-ink:#17354a; --icon-paper:rgba(255,246,229,.25);
  }
}
