/* The app shell: rail, search, conversation list, reading pane. Three columns from 1100 px, an icon rail from
   700, one column with a drawer below 700. */
/* the app scrolls only inside its panes: the page root never moves behind it (no double scroll in a web view) */
body.in-app { overflow: hidden; }
html:has(body.in-app) { overflow: hidden; overscroll-behavior: none; }
.app { height: 100dvh; display: grid; grid-template-columns: 264px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); gap: 14px;
  padding: max(14px, var(--sat)) max(14px, var(--sar)) max(14px, var(--sab)) max(14px, var(--sal)); }

/* ---- rail ---- */
.rail { display: flex; flex-direction: column; gap: 14px; min-height: 0; padding: 16px 12px 12px; border-radius: var(--r-xl);
  background: var(--glass); border: 1px solid var(--glass-edge); box-shadow: var(--shadow-1), var(--inner);
  -webkit-backdrop-filter: blur(26px) saturate(170%); backdrop-filter: blur(26px) saturate(170%); }
.brand { display: flex; align-items: center; gap: 11px; padding: 2px 6px 4px; color: var(--text); text-decoration: none; border-radius: 14px; }
.brand-mark { width: 42px; height: 42px; flex: none; display: grid; place-items: center; border-radius: 13px;
  background: linear-gradient(150deg, rgba(255, 255, 255, .95), rgba(245, 208, 254, .6) 60%, rgba(207, 250, 254, .6));
  border: 1px solid rgba(255, 255, 255, .95); box-shadow: inset 0 1px 0 #fff, 0 8px 18px -8px rgba(176, 31, 196, .55); }
[data-theme="dark"] .brand-mark { background: linear-gradient(150deg, rgba(255, 255, 255, .14), rgba(217, 70, 239, .2) 60%, rgba(34, 211, 238, .14)); border-color: rgba(255, 255, 255, .14); }
.brand-svg { width: 33px; height: 25px; }
.brand-word { display: grid; line-height: 1.05; }
.brand-word b { font: 800 18px/1.05 var(--display); letter-spacing: -.02em; }
.brand-word span { font: 600 13px/1.2 var(--display); color: var(--accent); letter-spacing: .02em; }
.compose-btn { min-height: 52px; border-radius: 17px; font-size: 15.5px; justify-content: flex-start; padding-inline: 18px; }
.compose-btn > svg, .compose-btn > span:not(.gleam) { position: relative; z-index: 1; }
.folders { display: grid; gap: 2px; overflow-y: auto; min-height: 0; margin-inline: -4px; padding-inline: 4px; }
.folder, .rail-link { position: relative; display: flex; align-items: center; gap: 13px; min-height: 44px; padding: 0 12px; border-radius: 14px;
  color: var(--text); text-decoration: none; font-weight: 500; font-size: 15px; transition: background-color .18s, color .18s, box-shadow .25s; }
.folder svg, .rail-link svg { width: 20px; height: 20px; color: var(--muted); flex: none; transition: color .18s; }
.f-ic { position: relative; display: grid; place-items: center; }
.folder:hover, .rail-link:hover { background: var(--hover); }
.folder.on, .rail-link.on { background: var(--glass-strong); color: var(--accent); font-weight: 650;
  box-shadow: 0 1px 2px rgba(64, 16, 84, .06), 0 8px 20px -12px color-mix(in srgb, var(--accent) 55%, transparent), inset 0 0 0 1px color-mix(in srgb, var(--accent) 16%, transparent); }
[data-theme="dark"] .folder.on, [data-theme="dark"] .rail-link.on { background: rgba(217, 70, 239, .14); }
.folder.on svg, .rail-link.on svg { color: var(--accent); }
.f-name, .rl-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.f-count { min-width: 24px; height: 22px; padding: 0 7px; display: grid; place-items: center; border-radius: 999px; font-size: 12.5px; font-weight: 700; color: var(--muted); }
.f-count.hot { color: #fff; background: linear-gradient(135deg, var(--btn-a), var(--btn-b)); box-shadow: 0 4px 12px -4px color-mix(in srgb, var(--accent) 70%, transparent); }
.rail-foot { margin-block-start: auto; display: grid; gap: 2px; padding-block-start: 10px; border-block-start: 1px solid var(--line); }
.account { display: flex; align-items: center; gap: 11px; margin-block-start: 6px; padding: 8px; border-radius: 16px; color: var(--text); text-decoration: none; background: var(--field); border: 1px solid var(--glass-hair); }
.account:hover { border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.acc-text { display: grid; min-width: 0; line-height: 1.3; }
.acc-name { font-weight: 650; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-addr { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: start; }

/* ---- main column and the search ---- */
.main { display: grid; grid-template-rows: auto minmax(0, 1fr); gap: 12px; min-width: 0; min-height: 0; }
.topbar { display: flex; align-items: center; gap: 10px; min-height: 54px; }
.menu-btn { display: none; }
.search { position: relative; flex: 1; max-width: 760px; display: flex; align-items: center; gap: 6px; height: 54px; padding-inline: 16px 6px; border-radius: 18px;
  background: var(--glass); border: 1px solid var(--glass-edge); box-shadow: var(--shadow-1), var(--inner);
  -webkit-backdrop-filter: blur(22px) saturate(170%); backdrop-filter: blur(22px) saturate(170%); transition: box-shadow .25s, background-color .25s; }
.search:focus-within { background: var(--glass-strong); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 14%, transparent), var(--shadow-2); }
.search-ic { width: 20px; height: 20px; color: var(--muted); flex: none; }
.search-input { flex: 1; min-width: 0; height: 100%; border: 0; background: transparent; font-size: 16px; outline: none; }
.search-input::-webkit-search-cancel-button { display: none; }
.search-input::placeholder { color: var(--muted); }
.top-tools { margin-inline-start: auto; display: flex; align-items: center; gap: 4px; }
.top-tools .icon-btn { background: var(--glass); border: 1px solid var(--glass-edge); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); }
.top-avatar { display: none; border-radius: 50%; }

/* ---- panes ---- */
.panes { display: grid; grid-template-columns: minmax(340px, 432px) minmax(0, 1fr); gap: 14px; min-height: 0; }
.list-host, .reader-host { min-width: 0; min-height: 0; display: flex; }
.page-host { grid-column: 1 / -1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }

/* ---- conversation list ---- */
.list-pane { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; border-radius: var(--r-xl); overflow: hidden;
  background: var(--glass); border: 1px solid var(--glass-edge); box-shadow: var(--shadow-2), var(--inner);
  -webkit-backdrop-filter: blur(26px) saturate(170%); backdrop-filter: blur(26px) saturate(170%); }
.list-head { display: flex; align-items: center; min-height: 68px; padding: 10px 10px 8px 12px; padding-inline: 12px 10px; border-block-end: 1px solid var(--line); }
.lh-main, .bulk { display: flex; align-items: center; gap: 8px; width: 100%; min-width: 0; }
.lh-text { flex: 1; min-width: 0; display: grid; }
.lh-title { font-size: 23px; font-weight: 800; letter-spacing: -.025em; line-height: 1.15; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lh-meta { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: start; }
.pick-all { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 12px; }
.pick-all:hover { background: var(--hover); }
.pick-all .box { width: 20px; height: 20px; display: grid; place-items: center; border-radius: 6px; color: transparent;
  border: 1.8px solid color-mix(in srgb, var(--muted) 75%, transparent); transition: background-color .2s, border-color .2s; }
.pick-all .box svg { width: 14px; height: 14px; stroke-width: 3; }
.pick-all[aria-pressed="true"] .box { color: #fff; border-color: transparent; background: linear-gradient(140deg, var(--accent), var(--accent2)); }
.bulk-count { font-weight: 700; white-space: nowrap; }
.bulk-actions { display: flex; align-items: center; gap: 0; margin-inline-start: auto; }
.bulk-actions .pick-all { width: 36px; height: 36px; }
.refresh-spin svg, .spin svg { animation: tm-spin .8s linear infinite; }
@keyframes tm-spin { to { transform: rotate(360deg); } }

.list-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 6px 6px 18px; }
.list-pane.is-empty .list-scroll { flex: 0 0 auto; padding: 0; }
.row { position: relative; display: grid; grid-template-columns: 44px minmax(0, 1fr) 38px; align-items: start; gap: 4px 10px;
  padding: 10px 6px 11px 8px; padding-inline: 8px 6px; border-radius: 18px; transition: background-color .16s, box-shadow .25s, opacity .3s, transform .35s var(--ease); }
.row + .row { margin-block-start: 1px; }
.row:hover { background: var(--hover); }
.row.active { background: var(--glass-strong); box-shadow: 0 1px 2px rgba(64, 16, 84, .05), 0 10px 26px -16px color-mix(in srgb, var(--accent) 60%, transparent), inset 0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent); }
[data-theme="dark"] .row.active { background: rgba(217, 70, 239, .12); }
.row.sel { background: var(--sel); }
.row.cursor { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent2) 55%, transparent); }
.row.leaving { opacity: 0; transform: perspective(700px) translateZ(-50px) rotateX(14deg); pointer-events: none; }
.row.fresh { animation: tm-fresh 1.6s ease both; }
@keyframes tm-fresh { from { background-color: color-mix(in srgb, var(--accent) 16%, transparent); } }
.pick { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; perspective: 360px; margin-block-start: 1px; }
.flipper { position: relative; width: 40px; height: 40px; transform-style: preserve-3d; transition: transform .5s var(--ease); }
.face { position: absolute; inset: 0; border-radius: 50%; -webkit-backface-visibility: hidden; backface-visibility: hidden; display: grid; place-items: center; }
.face.back { transform: rotateY(180deg); color: #fff; background: linear-gradient(140deg, var(--accent), var(--accent2)); box-shadow: inset 0 1px 1px rgba(255, 255, 255, .5), 0 4px 12px -4px color-mix(in srgb, var(--accent) 70%, transparent); }
.face.back svg { width: 20px; height: 20px; stroke-width: 2.6; }
.row.sel .flipper { transform: rotateY(180deg); }
.row-main { display: grid; gap: 1px; min-width: 0; color: inherit; text-decoration: none; padding-block: 1px; border-radius: 10px; }
.r1, .r2 { display: flex; align-items: center; gap: 7px; min-width: 0; }
.who { flex: 0 1 auto; min-width: 0; font-size: 15px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cnt { flex: none; font-size: 12.5px; color: var(--muted); }
.draftmark { flex: none; font-size: 12.5px; font-weight: 700; color: var(--bad); }
.when { flex: none; margin-inline-start: auto; font-size: 13px; color: var(--muted); white-space: nowrap; }
.subj { min-width: 0; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clip { flex: none; display: grid; color: var(--muted); }
.clip svg { width: 15px; height: 15px; }
.r3 { display: block; font-size: 14px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: match-parent; }
/* a size or a time next to Latin units keeps its own order in a Hebrew line ("13 kB", never "kB 13") */
.when, .att-size, .mh-time, .fl-time, .mb-store .muted { unicode-bidi: plaintext; }
.unread .who, .unread .subj { font-weight: 700; color: var(--text); }
.unread .when { color: var(--accent); font-weight: 700; }
.dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent), 0 0 10px color-mix(in srgb, var(--accent) 80%, transparent); }
.star { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; margin-block-start: 22px;
  color: color-mix(in srgb, var(--muted) 62%, transparent); transition: color .2s, transform .25s var(--ease), background-color .2s; }
.star svg { width: 19px; height: 19px; }
.star:hover { background: var(--hover); color: var(--accent); }
.star:active { transform: scale(.85); }
.starred .star { color: var(--accent); filter: drop-shadow(0 0 6px color-mix(in srgb, var(--accent) 55%, transparent)); }
/* hover actions sit over the time, before the star, on a solid surface so nothing shows through */
.quick { position: absolute; top: 8px; inset-inline-end: 50px; display: none; align-items: center; gap: 1px; padding: 3px; border-radius: 13px;
  background: var(--panel); border: 1px solid var(--glass-hair); box-shadow: 0 6px 18px -8px rgba(80, 20, 110, .35); }
[data-theme="dark"] .quick { background: var(--raised); }
@media (hover: hover) and (pointer: fine) {
  .row:hover .quick:not(:empty) { display: flex; animation: tm-menu .18s var(--ease) both; }
  .row:hover:has(.quick:not(:empty)) .when { visibility: hidden; }
}
.skeletons .row { pointer-events: none; }
.sk-row { grid-template-columns: 44px minmax(0, 1fr); padding-block: 14px; }
.sk-av { width: 40px; height: 40px; border-radius: 50%; }
.sk-lines { display: grid; gap: 9px; padding-block-start: 3px; }
.sk-lines .sk { height: 11px; }
.list-empty { flex: 1; display: grid; justify-items: center; align-content: center; gap: 12px; padding: 32px 28px 60px; text-align: center; color: var(--muted); font-size: 15px; }
.list-empty p { max-width: 30ch; margin-block-start: -4px; }
.list-empty h3 { margin-block-start: 6px; color: var(--text); font: 800 21px/1.25 var(--display); letter-spacing: -.02em; }
.empty-art { width: 208px; height: 156px; filter: drop-shadow(0 18px 24px color-mix(in srgb, var(--accent) 22%, transparent)); }
.empty-art .float { animation: tm-hover 6s ease-in-out infinite; transform-box: fill-box; }
@keyframes tm-hover { 50% { translate: 0 -6px; } }
.sentinel { height: 1px; }

/* ---- reading pane ---- */
.reader { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 10px; }
.reader-bar { align-self: flex-start; display: flex; align-items: center; gap: 2px; padding: 5px; max-width: 100%; overflow-x: auto; border-radius: 18px;
  background: var(--glass); border: 1px solid var(--glass-edge); box-shadow: var(--shadow-1), var(--inner);
  -webkit-backdrop-filter: blur(22px) saturate(170%); backdrop-filter: blur(22px) saturate(170%); }
.reader-bar .icon-btn.on { color: var(--accent); }
.bar-gap { width: 1px; height: 24px; margin: 0 5px; background: var(--line); flex: none; }
.reader-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 8px 2px 48px; scroll-padding-top: 12px; }
.reader-head { padding: 8px 6px 18px; }
.subject { font-size: clamp(24px, 2.3vw, 33px); font-weight: 800; letter-spacing: -.028em; line-height: 1.14; overflow-wrap: anywhere; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-block-start: 10px; }
.tag { display: inline-flex; align-items: center; min-height: 26px; padding: 0 11px; border-radius: 999px; font-size: 12.5px; font-weight: 600; color: var(--muted); background: var(--field); border: 1px solid var(--glass-hair); }
.held { display: flex; align-items: center; gap: 12px; margin: 0 2px 14px; padding: 10px 10px 10px 16px; padding-inline: 16px 10px; border-radius: 18px; font-size: 14px;
  background: color-mix(in srgb, var(--accent2) 9%, var(--glass-strong)); border: 1px solid color-mix(in srgb, var(--accent2) 26%, transparent); }
.held > svg { width: 20px; height: 20px; color: var(--accent2); flex: none; }
.held > span { flex: 1; }
.held .btn svg { width: 17px; height: 17px; }
.held.junk { background: color-mix(in srgb, var(--warn) 9%, var(--glass-strong)); border-color: color-mix(in srgb, var(--warn) 28%, transparent); }
.held.junk > svg { color: var(--warn); }
.msgs { display: grid; gap: 10px; }
.msg.open { padding: 18px 20px 20px; border-radius: 26px; box-shadow: var(--shadow-2), var(--inner); overflow: hidden; }
.msg.open:last-child { animation: tm-card-in .6s var(--ease) both; }
@keyframes tm-card-in { from { opacity: 0; transform: perspective(1200px) translateZ(-60px) rotateX(6deg); } }
.fold-line { width: 100%; display: grid; grid-template-columns: 34px auto minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 10px 16px; min-height: 56px; text-align: start;
  border-radius: 20px; background: var(--glass); border: 1px solid var(--glass-edge); box-shadow: var(--shadow-1); transition: background-color .2s; }
.fold-line:hover { background: var(--glass-strong); }
.fl-name { font-weight: 650; white-space: nowrap; max-width: 22ch; overflow: hidden; text-overflow: ellipsis; }
.fl-snip { color: var(--muted); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 14px; text-align: match-parent; }
.fl-time { color: var(--muted); font-size: 13px; white-space: nowrap; }
.msg-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; gap: 12px; }
.mh-who { min-width: 0; padding-block-start: 1px; }
.mh-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 8px; min-width: 0; }
.mh-name { font-weight: 700; font-size: 15.5px; }
.mh-addr { color: var(--muted); font-size: 13.5px; overflow-wrap: anywhere; }
.to-line { display: inline-flex; align-items: center; gap: 4px; min-height: 28px; max-width: 100%; color: var(--muted); font-size: 13.5px; border-radius: 8px; }
.to-line span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.to-line svg { width: 15px; height: 15px; flex: none; transition: transform .25s var(--ease); }
.to-line[aria-expanded="true"] svg { transform: rotate(180deg); }
.mh-side { display: flex; align-items: center; gap: 0; }
.mh-time { color: var(--muted); font-size: 13px; white-space: nowrap; margin-inline-end: 4px; }
.mh-side .icon-btn.on { color: var(--accent); }
.details { display: grid; gap: 5px; margin-block-start: 10px; margin-inline-start: 54px; padding: 12px 14px; border-radius: 14px; font-size: 13.5px; background: var(--field); border: 1px solid var(--glass-hair); }
.dt { display: grid; grid-template-columns: minmax(80px, 120px) minmax(0, 1fr); gap: 10px; }
.dt-k { color: var(--muted); }
.dt-v { overflow-wrap: anywhere; }
.addr { color: var(--muted); }
/* a long address moves under the name as one piece instead of breaking at its hyphen, its own brackets kept with it */
.dt-v .addr { display: inline-block; max-width: 100%; overflow-wrap: anywhere; }
.mail-body { margin-block-start: 14px; margin-inline-start: 54px; }
.mail-body.paper { padding: 4px; border-radius: 18px; background: #FFFFFF; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .06), 0 10px 30px -18px rgba(0, 0, 0, .6); }
.mail-frame { display: block; width: 100%; height: 48px; border: 0; background: transparent; }
.atts { display: flex; flex-wrap: wrap; gap: 10px; margin-block-start: 16px; margin-inline-start: 54px; }
.att { display: flex; align-items: center; gap: 11px; min-height: 58px; max-width: 290px; padding: 8px 12px 8px 8px; padding-inline: 8px 12px; border-radius: 18px;
  color: inherit; text-decoration: none; background: var(--field); border: 1px solid var(--glass-hair); transition: border-color .2s, box-shadow .25s, transform .2s var(--ease); }
.att:hover { border-color: color-mix(in srgb, var(--accent) 35%, transparent); box-shadow: var(--shadow-1); }
.att:active { transform: scale(.98); }
.att-tile { width: 42px; height: 42px; flex: none; display: grid; place-items: center; border-radius: 12px; color: #fff; font: 800 11px/1 var(--font); letter-spacing: .04em;
  background: linear-gradient(140deg, #8B5CF6, #6D28D9); box-shadow: inset 0 1px 1px rgba(255, 255, 255, .35); }
.att-tile[data-kind="pdf"] { background: linear-gradient(140deg, #F43F6B, #BE123C); }
.att-tile[data-kind="doc"] { background: linear-gradient(140deg, #22D3EE, #0A7FA0); }
.att-tile[data-kind="sheet"] { background: linear-gradient(140deg, #34D399, #2F8A3A); }
.att-tile[data-kind="zip"] { background: linear-gradient(140deg, #F5B24B, #B7790C); }
.att-tile[data-kind="media"] { background: linear-gradient(140deg, #E879F9, #B01FC4); }
.att-tile[data-kind="bad"] { background: color-mix(in srgb, var(--bad) 16%, transparent); color: var(--bad); }
.att-tile svg { width: 20px; height: 20px; }
.att-tile.thumb { overflow: hidden; background: var(--raised); }
.att-tile.thumb img { width: 100%; height: 100%; object-fit: cover; }
.att-text { display: grid; min-width: 0; line-height: 1.3; }
.att-name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-size { font-size: 12.5px; color: var(--muted); }
.att-dl { display: grid; color: var(--muted); margin-inline-start: auto; padding-inline-start: 6px; }
.att-dl svg { width: 18px; height: 18px; }
.draft-actions { margin-block-start: 14px; margin-inline-start: 54px; }
.reply-bar { display: flex; flex-wrap: wrap; gap: 10px; padding: 18px 2px 0; margin-inline-start: 54px; }
.reply-bar .btn { border-radius: 999px; padding-inline: 18px 22px; background: var(--glass-strong); }
.reader-empty { flex: 1; display: grid; justify-items: center; align-content: center; gap: 8px; padding: 24px; text-align: center; }
.reader-empty h2 { font-size: 27px; font-weight: 800; letter-spacing: -.025em; }
.reader-empty p { color: var(--muted); }
/* the empty reading pane is a quiet glass stage with the crystal envelope idling on a lit floor */
.reader.is-empty { position: relative; overflow: hidden; border-radius: var(--r-xl); background: var(--glass); border: 1px solid var(--glass-edge);
  box-shadow: var(--shadow-1), var(--inner); -webkit-backdrop-filter: blur(26px) saturate(170%); backdrop-filter: blur(26px) saturate(170%); }
.reader.is-empty::before { content: ""; position: absolute; inset: auto 12% 18% 12%; height: 38%; border-radius: 50%; pointer-events: none;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 16%, transparent), color-mix(in srgb, var(--accent2) 8%, transparent) 60%, transparent); filter: blur(18px); }
.reader.is-empty .reader-empty { position: relative; }
.idle-env { position: relative; width: min(420px, 78%); aspect-ratio: 4 / 3; margin-block-end: 4px; }
.idle-env canvas { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; transition: opacity .45s ease; }
.idle-env.live canvas { opacity: 1; }
.idle-svg { position: absolute; inset: 16% 10% 14%; width: 80%; height: 70%; animation: tm-float 7s ease-in-out infinite; transition: opacity .3s; filter: drop-shadow(0 24px 30px rgba(140, 40, 190, .25)); }
.idle-env.live .idle-svg { opacity: 0; }
.reader-loading { display: grid; gap: 18px; padding: 26px 8px; }
.sk-card { display: flex; align-items: center; gap: 12px; }
.fab { display: none; }
/* the drawer scrim lives only under 700 px; above it, it must not take an implicit grid row and shorten the panes */
.drawer-scrim { display: none; }

/* ---- 700 to 1099: the rail folds to icons ---- */
@media (max-width: 1099px) and (min-width: 700px) {
  .app { grid-template-columns: 78px minmax(0, 1fr); gap: 12px; }
  .rail { padding: 14px 10px; align-items: center; }
  .brand { padding: 0; }
  .brand-word, .f-name, .rl-label, .acc-text, .cb-label { display: none; }
  .compose-btn { width: 54px; min-height: 54px; padding: 0; justify-content: center; }
  .folders { justify-items: center; margin: 0; padding: 0; }
  .folder, .rail-link { width: 50px; justify-content: center; padding: 0; }
  .f-count { position: absolute; top: 3px; inset-inline-end: 1px; min-width: 18px; height: 18px; padding: 0 5px; font-size: 11px; }
  .f-count:not(.hot) { display: none; }
  .rail-foot { justify-items: center; width: 100%; }
  .account { padding: 6px; background: none; border: 0; }
  .panes { grid-template-columns: minmax(300px, 370px) minmax(0, 1fr); gap: 12px; }
}

/* ---- under 700: one column, a drawer and a floating Compose ---- */
@media (max-width: 699px) {
  .app { display: block; height: 100dvh; padding: 0; }
  .main { height: 100dvh; display: flex; flex-direction: column; gap: 0; }
  .topbar { padding: calc(8px + var(--sat)) max(10px, var(--sar)) 8px max(10px, var(--sal)); gap: 6px; min-height: 0; }
  .menu-btn { display: inline-grid; color: var(--text); }
  .search { height: 50px; border-radius: 16px; padding-inline: 12px 4px; }
  .top-tools { display: none; }
  .top-avatar { display: grid; place-items: center; width: 44px; height: 44px; flex: none; }
  .rail { position: fixed; z-index: 60; inset-block: 0; inset-inline-start: 0; width: min(312px, 86vw); border-radius: 0; border-start-end-radius: 28px; border-end-end-radius: 28px;
    padding: calc(18px + var(--sat)) 14px calc(14px + var(--sab)); background: var(--glass-strong); transform: translateX(-105%); transition: transform .42s var(--ease); visibility: hidden; }
  [dir="rtl"] .rail { transform: translateX(105%); }
  .drawer-open .rail { transform: none; visibility: visible; box-shadow: var(--shadow-3); }
  .drawer-scrim { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(20, 6, 32, .36); opacity: 0; pointer-events: none; transition: opacity .35s; }
  .drawer-open .drawer-scrim { opacity: 1; pointer-events: auto; }
  .panes { display: block; position: relative; flex: 1; min-height: 0; }
  .list-host, .reader-host { position: absolute; inset: 0; }
  .page-host { position: absolute; inset: 0; padding: 0 max(12px, var(--sar)) var(--sab) max(12px, var(--sal)); }
  [data-view="thread"] .list-host, [data-view="list"] .reader-host { visibility: hidden; pointer-events: none; }
  /* a conversation is its own screen: its action bar is the top bar, so the reading gets the whole height */
  [data-view="thread"] .topbar { display: none; }
  [data-view="thread"] .reader { padding-top: calc(8px + var(--sat)); }
  [data-view="thread"] .reader-host { animation: tm-screen-in .38s var(--ease) both; }
  @keyframes tm-screen-in { from { opacity: 0; transform: perspective(900px) translateZ(-50px); } }
  .list-pane { border-radius: 26px 26px 0 0; border-block-end: 0; margin-inline: 6px; }
  .list-head { min-height: 60px; padding-inline: 10px 6px; }
  .lh-title { font-size: 21px; }
  .list-scroll { padding: 4px 4px calc(96px + var(--sab)); }
  .row { padding-inline: 6px 2px; }
  .star { margin-block-start: 20px; }
  .reader { padding: 0 max(8px, var(--sar)) 0 max(8px, var(--sal)); gap: 6px; }
  .reader-bar { align-self: stretch; }
  .reader-scroll { padding-block-end: calc(40px + var(--sab)); }
  .reader-head { padding: 6px 6px 14px; }
  .subject { font-size: 24px; }
  .msg.open { padding: 14px 14px 16px; border-radius: 22px; }
  .details, .mail-body, .atts, .reply-bar, .draft-actions { margin-inline-start: 0; }
  .dt { grid-template-columns: max-content minmax(0, 1fr); gap: 12px; }
  .mh-side .icon-btn:not(:last-child) { display: none; }
  .fold-line { grid-template-columns: 34px minmax(0, 1fr) auto; }
  .fl-snip { display: none; }
  .att { max-width: 100%; flex: 1 1 100%; }
  .fab { position: fixed; z-index: 40; inset-inline-end: max(16px, var(--sar)); bottom: calc(18px + var(--sab)); display: inline-flex; align-items: center; gap: 10px;
    height: 58px; padding: 0 22px; border-radius: 20px; color: #fff; font-weight: 700; font-size: 15.5px; overflow: hidden; isolation: isolate;
    background: linear-gradient(135deg, var(--btn-a), var(--btn-b)); box-shadow: 0 1px 0 rgba(255, 255, 255, .35) inset, 0 16px 34px -12px color-mix(in srgb, var(--accent) 80%, transparent); }
  .fab svg { width: 21px; height: 21px; position: relative; z-index: 1; }
  .fab-label { position: relative; z-index: 1; }
  [data-view="thread"] .fab, [data-view="page"] .fab { display: none; }
  body.in-app .toasts { bottom: calc(90px + var(--sab)); }
}
