/* Row 677: Sähköposti in the room/Files light look (rows 655/672): the shell is exactly the view's height, the page
   never scrolls, each panel scrolls inside itself, the borders between panels can be dragged (widths remembered per
   device by view.cjs). Every rule is scoped to #mail-root, except the first two. */
main.mail-mode { max-width:none; height:100vh; height:100dvh; min-height:0; padding-top:10px; padding-bottom:10px; overflow:hidden; }
#mail-view:not(.hidden) { display:flex; flex-direction:column; flex:1 1 auto; min-height:0; }
#mail-root { flex:1 1 auto; min-height:0; overflow:hidden; display:flex; color:var(--u-ink); font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif; font-size:14px; line-height:1.4; }
#mail-root .mv-shell { --mv-reader:640px; display:grid; grid-template-rows:auto minmax(0,1fr); flex:1; min-height:0; min-width:0; gap:10px; background:var(--u-paper); }
#mail-root button { border:1px solid var(--u-line); border-radius:10px; background:var(--u-card); color:var(--u-ink); padding:6px 12px; font:inherit; cursor:pointer; }
#mail-root button:hover { border-color:var(--u-mid); color:var(--u-accent); }
#mail-root :focus-visible { outline:2px solid var(--u-focus); outline-offset:2px; }
#mail-root h1 { font-size:20px; margin:0; white-space:nowrap; }
#mail-root h2 { font-size:16px; margin:0; overflow-wrap:anywhere; }
#mail-root h3 { font-size:14px; margin:0 0 4px; }
#mail-root p { margin:0; }
#mail-root [hidden] { display:none !important; }
#mail-root .mv-top { display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
#mail-root .mv-heading { color:var(--u-muted); flex:1 1 auto; }
/* Row 1083: one bounded row. Without it the implicit auto row grows to the reader's content height, so .mv-reader
   never overflows (nothing to scroll) and the end of a long message is clipped by the overflow:hidden chain above. */
/* Row 1141: two columns, message list (about a third) | reader (about two thirds, --mv-reader); the folder and account
   picker (.mv-rail) floats over the list instead of taking a column or list height. */
#mail-root .mv-columns { display:grid; grid-template-columns:minmax(300px,1fr) 6px var(--mv-reader); grid-template-rows:minmax(0,1fr); min-height:0; overflow:hidden; position:relative; }
#mail-root .mv-shell[data-folder="acks"] .mv-columns { grid-template-columns:minmax(320px,1fr); }
#mail-root .mv-shell[data-expanded="1"] .mv-columns { grid-template-columns:minmax(0,1fr); }
#mail-root .mv-shell[data-expanded="1"] .mv-list-col, #mail-root .mv-shell[data-expanded="1"] .mv-sep { display:none; }
#mail-root .mv-rail, #mail-root .mv-list-col, #mail-root .mv-reader { min-height:0; overflow-y:auto; overscroll-behavior:contain; background:var(--u-card); border:1px solid var(--u-line); border-radius:12px; padding:10px; }
#mail-root .mv-list-col { display:flex; flex-direction:column; padding:0; overflow:hidden; }
#mail-root .mv-sep { cursor:col-resize; touch-action:none; }
#mail-root .mv-sep:hover { background:var(--u-wash); border-radius:3px; }
#mail-root ul { list-style:none; margin:0; padding:0; }
#mail-root .mv-folder { width:100%; display:flex; align-items:center; gap:8px; text-align:left; border:0; border-radius:8px; margin:1px 0; }
#mail-root .mv-folder-name { flex:1 1 auto; overflow-wrap:anywhere; }
#mail-root .mv-folder.current { background:var(--u-wash); color:var(--u-accent); font-weight:600; }
#mail-root .mv-count { min-width:20px; padding:0 6px; border-radius:999px; background:var(--u-button); color:var(--u-white); font-size:12px; font-weight:700; text-align:center; }
#mail-root .mv-warnings { margin-top:10px; display:grid; gap:6px; }
#mail-root .mv-warning { padding:6px 10px; border-radius:10px; background:var(--u-mark); color:var(--u-warmtext); font-size:13px; }
#mail-root .mv-list-head { padding:10px 12px 6px; font-weight:600; border-bottom:1px solid var(--u-line); }
#mail-root .mv-search { display:grid; gap:4px; padding:8px 12px; font-weight:600; }
#mail-root .mv-search input { min-width:0; width:100%; box-sizing:border-box; padding:7px 9px; font:inherit; font-weight:400; border:1px solid var(--u-line); border-radius:8px; background:var(--u-card); color:var(--u-ink); }
#mail-root .mv-list-status { padding:0 12px; color:var(--u-muted); }
#mail-root .mv-list-status:not(:empty) { padding:12px; }
#mail-root .mv-list-status[data-kind="error"] { color:var(--u-alert); }
#mail-root .mv-list-scroll { flex:1 1 auto; min-height:0; overflow-y:auto; overscroll-behavior:contain; }
#mail-root .mv-list { margin:0; outline:none; }
#mail-root .mv-row { display:grid; grid-template-columns:10px minmax(90px,180px) minmax(0,1fr) 18px auto; align-items:center; gap:10px; padding:8px 12px; border-bottom:1px solid var(--u-line); cursor:pointer; color:var(--u-ink); }
#mail-root .mv-row:hover { background:var(--u-wash); }
#mail-root .mv-row.selected { background:var(--u-wash); }
#mail-root .mv-row.unread { color:var(--u-ink); font-weight:700; }
#mail-root .mv-from, #mail-root .mv-line { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
#mail-root .mv-snippet { color:var(--u-muted); font-weight:400; }
#mail-root .mv-time { color:var(--u-muted); font-size:12px; white-space:nowrap; text-align:right; }
#mail-root .mv-row.unread .mv-time { color:var(--u-ink); }
#mail-root .mv-more { padding:8px 12px; display:flex; align-items:center; gap:10px; color:var(--u-muted); font-size:13px; }
#mail-root .mv-more:empty { display:none; }
#mail-root .mv-acks { padding:12px; overflow-y:auto; min-height:0; flex:1 1 auto; }
#mail-root .mv-reader { padding:16px; }
#mail-root .mv-reader-head { display:grid; gap:6px; padding-bottom:10px; border-bottom:1px solid var(--u-line); margin-bottom:12px; }
#mail-root .mv-meta { display:grid; grid-template-columns:auto minmax(0,1fr); gap:2px 10px; margin:0; font-size:13px; }
#mail-root .mv-meta dt { color:var(--u-muted); }
#mail-root .mv-meta dd { margin:0; overflow-wrap:anywhere; }
#mail-root .mv-when { color:var(--u-muted); font-size:13px; }
#mail-root .mv-body { white-space:pre-wrap; overflow-wrap:anywhere; word-break:break-word; }
#mail-root .mv-link { color:var(--u-accent); text-decoration:underline; text-underline-offset:2px; overflow-wrap:anywhere; }
#mail-root .mv-link:focus-visible { outline:2px solid var(--u-accent); outline-offset:2px; border-radius:2px; }
#mail-root .mv-earlier { margin-top:14px; }
#mail-root .mv-earlier summary { cursor:pointer; color:var(--u-accent); }
#mail-root .mv-earlier-text { margin-top:8px; padding-left:10px; border-left:3px solid var(--u-line); color:var(--u-muted); }
#mail-root .mv-notice { color:var(--u-muted); font-size:13px; margin-top:10px; }
#mail-root .mv-attachments { margin-top:14px; padding-top:10px; border-top:1px solid var(--u-line); }
#mail-root .mv-attachments li { padding:2px 0; overflow-wrap:anywhere; }
#mail-root .mv-empty { color:var(--u-muted); padding:12px 0; }
#mail-root .mv-error { padding:8px 12px; border-radius:10px; background:var(--u-alertwash); color:var(--u-alert); }
#mail-root .mv-close { margin-bottom:10px; }
/* Narrow window / mobile: one column; the message opens over the whole view. */
#mail-root .mv-shell[data-layout="narrow"] .mv-columns { grid-template-columns:minmax(0,1fr); grid-template-rows:minmax(0,1fr); gap:8px; }
#mail-root .mv-shell[data-layout="narrow"] .mv-sep { display:none; }
#mail-root .mv-shell[data-layout="narrow"] .mv-folders { display:flex; flex-wrap:wrap; gap:4px; }
#mail-root .mv-shell[data-layout="narrow"] .mv-folder { width:auto; border:1px solid var(--u-line); }
#mail-root .mv-shell[data-layout="narrow"] .mv-reader { display:none; }
#mail-root .mv-shell[data-layout="narrow"][data-reader="open"] .mv-reader { display:block; position:absolute; inset:0; z-index:2; }
#mail-root .mv-shell[data-layout="narrow"] .mv-row { grid-template-columns:10px minmax(0,1fr) auto auto; grid-template-areas:"dot from attach time" "dot line line line"; column-gap:6px; row-gap:2px; }
#mail-root .mv-shell[data-layout="narrow"] .mv-from { grid-area:from; }
#mail-root .mv-shell[data-layout="narrow"] .mv-line { grid-area:line; }
#mail-root .mv-shell[data-layout="narrow"] .mv-time { grid-area:time; }
/* Review 677 #2: the attachment mark stays visible on mobile, beside the time; an empty mark takes no width. */
#mail-root .mv-shell[data-layout="narrow"] .mv-attach { grid-area:attach; display:inline; min-width:0; }
#mail-root .mv-shell[data-layout="narrow"] .mv-attach:empty { display:none; }

/* Keep the decorative figure outside the account labels and the native checkbox in the tab order. */
#mail-root .mv-accounts-head {
  display:flex; align-items:center; justify-content:space-between; gap:.5rem;
  margin:.6rem 0 .35rem; padding-inline:.35rem; font:500 1.4rem/1.2 var(--wc-serif,Georgia,serif);
}
#mail-root .mv-rail {
  background-image:linear-gradient(to bottom,var(--u-card) 0%,transparent 86%),
    linear-gradient(color-mix(in srgb,var(--u-card) 68%,transparent),color-mix(in srgb,var(--u-card) 68%,transparent)),
    url("../assets/adele-mail-rail.jpg");
  background-position:center,center,48% bottom;
  background-size:cover,cover,auto 85%;
  background-repeat:no-repeat;
}
#mail-root .mv-draft-action {
  display:inline-flex; align-items:center; gap:.55rem; min-height:44px; margin:.45rem 0;
  padding:.35rem .85rem; border:1px solid var(--u-line); border-radius:9px;
  background:color-mix(in srgb,var(--u-card) 94%,#b1aa8e); color:var(--u-ink); font:inherit;
}
#mail-root .mv-draft-action::before {
  content:""; width:1.55rem; height:1.45rem; flex:none;
  background:url("../assets/adele-reply-fan.svg") center/contain no-repeat;
}
#mail-root .mv-draft-action:hover { border-color:var(--u-ink); }
#mail-root .mv-draft-action:focus-visible { outline:2px solid currentColor; outline-offset:2px; }
#mail-root .mv-draft-status { display:block; }
#mail-root .mv-draft-card { padding:.65rem; border-bottom:1px solid var(--u-line); overflow-wrap:anywhere; }
#mail-root .mv-draft-card summary { min-height:44px; align-content:center; cursor:pointer; }
#mail-root .mv-draft-card textarea { display:block; width:100%; box-sizing:border-box; font:inherit; }
#mail-root .mv-draft-panel [type="button"] { min-height:44px; }
#mail-root .mv-folder .mv-count[hidden] { display:none; }
@media (forced-colors:active) {
  #mail-root .mv-rail { background-image:none; }
}
#mail-root .mv-accounts, #mail-root .mv-shell[data-layout="narrow"] .mv-accounts { display:grid; gap:.3rem; }
#mail-root .mv-account label {
  display:grid; grid-template-columns:1.15rem minmax(0,1fr) auto; gap:.55rem; align-items:center;
  min-height:44px; min-width:0; margin:0; padding:.35rem .55rem; cursor:pointer;
  background:var(--u-card); border:1px solid var(--u-line); border-radius:9px;
}
#mail-root .mv-account label:has(input:checked) {
  background:color-mix(in srgb,var(--mv-account-color) 7%,var(--u-card));
  border-color:color-mix(in srgb,var(--mv-account-color) 32%,var(--u-line));
}
#mail-root .mv-account label:hover { border-color:var(--mv-account-color); }
#mail-root .mv-account label > input[type="checkbox"] {
  grid-area:1 / 1; appearance:none; -webkit-appearance:none; display:grid; place-content:center;
  width:1.15rem; height:1.15rem; box-sizing:border-box; margin:0; min-width:0; padding:0;
  border:2px solid var(--mv-account-color); border-radius:4px; background:var(--u-card); cursor:pointer;
}
#mail-root .mv-account input[type="checkbox"]:checked { background:var(--mv-account-color); }
#mail-root .mv-account input[type="checkbox"]:checked::after {
  content:""; width:.52rem; height:.26rem; border:solid white; border-width:0 0 2px 2px; transform:translateY(-1px) rotate(-45deg);
}
#mail-root .mv-account label > .mv-account-name { grid-area:1 / 2; }
#mail-root .mv-account-name { min-width:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
#mail-root .mv-account label > .mv-count { grid-area:1 / 3; background:var(--u-wash); color:var(--u-ink); }
#mail-root .mv-shell[data-layout="narrow"] .mv-rail { background-size:cover,cover,auto 100%; background-position:center,center,right bottom; }
#mail-root .mv-account-chip {
  display:inline-block; justify-self:start; width:fit-content; max-width:100%; overflow-wrap:anywhere;
  padding:.13em .55em; border-radius:.4em; color:white; background:var(--mv-account-color);
  font-size:.8rem; line-height:1.35; font-weight:600;
}
@media (prefers-color-scheme:dark) {
  #mail-root .mv-rail { background-blend-mode:normal,multiply,luminosity; }
  #mail-root .mv-account label > input[type="checkbox"] { border-color:color-mix(in srgb,var(--mv-account-color),white 55%); }
}
@media (forced-colors:active) {
  #mail-root .mv-account label > input[type="checkbox"] { appearance:auto; -webkit-appearance:auto; }
  #mail-root .mv-account input[type="checkbox"]:checked::after { content:none; }
}
#mail-root .mv-read-filters { display:flex; flex-wrap:wrap; gap:.25rem; padding:.25rem .75rem .5rem; }
#mail-root .mv-read-filter { padding:.35rem .65rem; min-height:40px; font-size:.9375rem; }
#mail-root .mv-read-filter[aria-pressed="true"] { color:var(--u-accent); background:var(--u-wash); border-color:currentColor; font-weight:650; }
#mail-root .mv-mark-read { padding:.35rem .65rem; min-height:40px; font-size:.9375rem; margin-left:auto; }
#mail-root .mv-mark-read[hidden], #mail-root .mv-mark-status[hidden] { display:none; }
#mail-root .mv-mark-status { margin:.25rem 0; color:var(--u-muted); font-size:.9em; }
#mail-root .mv-folder-tag { display:inline-block; margin-right:.4rem; padding:0 .35rem; border:1px solid currentColor; border-radius:4px; color:var(--u-muted); font-size:.8em; font-weight:500; max-width:12em; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; vertical-align:baseline; }
#mail-root .mv-row, #mail-root .mv-shell[data-layout="narrow"] .mv-row {
  grid-template-columns:minmax(0,1fr) auto auto;
  grid-template-areas:"from attach time" "line line line" "status status status";
  gap:.15rem .5rem; padding:.65rem .8rem; align-items:baseline;
}
#mail-root .mv-from { grid-area:from; font-weight:600; }
#mail-root .mv-time { grid-area:time; font-variant-numeric:tabular-nums; }
#mail-root .mv-attach { grid-area:attach; }
#mail-root .mv-line { grid-area:line; }
#mail-root .mv-from, #mail-root .mv-line { min-width:0; white-space:normal; overflow-wrap:anywhere; }
#mail-root .mv-subject, #mail-root .mv-snippet { display:block; }
#mail-root .mv-snippet { font-size:.9em; line-height:1.45; display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:2; overflow:hidden; }
#mail-root .mv-read-state { grid-area:status; color:var(--u-muted); font-weight:400; font-size:.8em; }
#mail-root .unread .mv-read-state { color:var(--u-accent); font-weight:700; }
#mail-root .mv-row.selected { box-shadow:inset 3px 0 var(--u-accent); }
#mail-root .mv-reader { min-width:0; padding:clamp(.85rem,2vw,1.75rem); }
#mail-root .mv-reader h2 { font-size:clamp(1.25rem,2vw,1.7rem); line-height:1.25; }
#mail-root .mv-body { max-width:72ch; font-size:1rem; line-height:1.6; }
#mail-root .mv-read-notice, #mail-root .mv-more { display:flex; align-items:center; flex-wrap:wrap; gap:.5rem; }
#mail-root .mv-more:empty { display:none; }
#mail-root .mv-search input { font-size:max(16px,1rem); }
@media (max-width:600px) {
  #mail-root .mv-heading { display:none; }
  #mail-root .mv-refresh { margin-left:auto; }
  #mail-root .mv-reader .mv-meta { display:block; }
  #mail-root .mv-meta dd { margin:0 0 .4rem; }
  #mail-root .mv-read-filter { min-height:44px; }
  #mail-root .mv-rail, #mail-root .mv-reader { scroll-padding-bottom:max(1rem,env(safe-area-inset-bottom)); }
}
#mail-root .mv-reader-head .mv-draft-action { justify-self:start; max-width:100%; }
#mail-root .mv-draft-status:empty { display:none; }

/* Row 1103: message and reply translation, reply tone, "Poista ehdotus" (red, apart from send) and its undo. */
#mail-root .mv-translation, #mail-root .mv-draft-translation { margin:.6rem 0; padding:.65rem .75rem; border-radius:8px; background:var(--u-wash); }
#mail-root .mv-translation > strong, #mail-root .mv-draft-translation > strong { display:block; margin-bottom:.25rem; }
#mail-root .mv-draft-finnish p { margin:.3rem 0; }
#mail-root .mv-translate-lang { margin:0; font-size:.85rem; color:var(--u-mid); }
#mail-root .mv-original summary, #mail-root .mv-draft-translation summary { min-height:44px; align-content:center; cursor:pointer; color:var(--u-accent); }
#mail-root .mv-original-text > strong { display:block; margin:.4rem 0; }
#mail-root .mv-translate-status { display:flex; align-items:center; flex-wrap:wrap; gap:.5rem; }
#mail-root .mv-draft-tone { margin:.6rem 0; padding:.4rem .65rem .6rem; border:1px solid var(--u-line); border-radius:8px; }
#mail-root .mv-draft-tone legend { font-weight:600; padding:0 .25rem; }
#mail-root .mv-tone-options { display:flex; flex-wrap:wrap; align-items:center; gap:.5rem; }
/* Row 1107: the generic "input, select" rule (style.css) gives every input text-field width, margin and padding; a
   tone radio keeps its own small size here, an option never breaks inside its words, and whole options and the
   regenerate button wrap to the next line when the row is narrow. */
#mail-root .mv-tone-option {
  display:inline-flex; flex:0 0 auto; align-items:center; gap:.35rem;
  min-height:44px; padding:0 .5rem; border-radius:8px; white-space:nowrap;
}
#mail-root .mv-tone-option input[type="radio"] {
  flex:0 0 auto; width:1rem; height:1rem; min-width:0; margin:0; padding:0;
  box-shadow:none; accent-color:var(--u-accent);
}
#mail-root .mv-tone-options .mv-draft-regenerate { flex:0 1 auto; max-width:100%; }
#mail-root .mv-tone-option:has(:checked) { background:var(--u-wash); }
#mail-root .mv-draft-confirm, #mail-root .mv-draft-actions { display:flex; flex-wrap:wrap; align-items:center; gap:.5rem; margin-top:.5rem; }
#mail-root .mv-draft-actions .mv-draft-remove { margin-left:auto; }
#mail-root .mv-draft-remove, #mail-root .mv-draft-remove:hover { color:var(--u-alert); border-color:currentColor; }
#mail-root .mv-draft-label > span { display:block; font-weight:600; margin:.4rem 0 .2rem; }
#mail-root .mv-draft-removed { padding:.4rem 0; }
#mail-root .mv-draft-remove-status:empty, #mail-root .mv-draft-translation-status:empty { display:none; }

/* Row 1141: toolbar (picker + search icon), picker menu / bottom sheet, list rows, reader width. */
#mail-root .mv-toolbar { display:flex; align-items:center; gap:.4rem; padding:.5rem .75rem; border-bottom:1px solid var(--u-line); }
#mail-root .mv-picker { flex:1 1 auto; min-width:0; min-height:44px; display:flex; align-items:center; gap:.4rem; text-align:left; font-weight:650; }
#mail-root .mv-picker-label { flex:1 1 auto; min-width:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
#mail-root .mv-picker-caret { color:var(--u-muted); }
#mail-root .mv-search-toggle { flex:none; min-width:44px; min-height:44px; padding:0; }
#mail-root .mv-search-chip { flex:0 1 auto; min-width:0; max-width:40%; min-height:44px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; color:var(--u-accent); background:var(--u-wash); }
#mail-root .mv-warnings { margin:0; padding:0 .75rem; }
#mail-root .mv-warnings:not(:empty) { padding-block:.4rem; }
#mail-root .mv-rail { position:absolute; top:3.6rem; left:0; z-index:5; width:min(22rem, calc(100% - 1.5rem)); max-height:calc(100% - 4rem); box-sizing:border-box; box-shadow:0 10px 30px rgb(0 0 0 / 18%); }
#mail-root .mv-picker-actions { display:flex; justify-content:flex-end; flex-wrap:wrap; gap:.5rem; margin-top:.75rem; position:sticky; bottom:0; }
#mail-root .mv-picker-actions button { min-height:44px; }
#mail-root .mv-picker-apply { background:var(--u-button); color:var(--u-white); border-color:var(--u-button); font-weight:650; }
#mail-root .mv-shell[data-layout="narrow"] .mv-rail { position:fixed; top:auto; left:0; right:0; bottom:0; width:auto; max-height:80vh; max-height:80dvh; border-radius:16px 16px 0 0; padding-bottom:max(12px, env(safe-area-inset-bottom)); }
#mail-root .mv-row .mv-snippet { -webkit-line-clamp:1; }
#mail-root .mv-read-state { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }
#mail-root .mv-row { position:relative; }
#mail-root .mv-row.unread .mv-from::before { content:""; display:inline-block; width:.5rem; height:.5rem; margin-right:.4rem; border-radius:50%; background:var(--u-accent); vertical-align:.1em; }
#mail-root .mv-row, #mail-root .mv-shell[data-layout="narrow"] .mv-row { grid-template-areas:"from attach time" "line line line"; }
#mail-root .mv-reader .mv-body { max-width:70ch; }
#mail-root .mv-expand { margin:0 0 10px .5rem; }
#mail-root .mv-shell[data-layout="narrow"] .mv-list-scroll { scroll-padding-bottom:max(1rem, env(safe-area-inset-bottom)); padding-bottom:env(safe-area-inset-bottom); }
