/* First Class Mail · Webmail
   Colours: the charcoal, grey and white of the "New Message" window.
   Type: the same fonts and sizes as the admin panel (13 px text, serif headings). */
:root {
  --font-ui: 13px;
  --font-heading: 26px;
  --font-subheading: 18px;
  --font-brand: 20px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, "Liberation Mono", monospace;

  --charcoal: #2E2F33;
  --charcoal-2: #45464C;
  --bar: #E4E4E9;        /* toolbar / window footer grey */
  --bar-2: #EEEEF1;      /* lighter strip */
  --page: #C9C9CE;       /* backdrop */
  --side: #F6F6F8;       /* folder pane */
  --white: #FFFFFF;
  --line: #D9D9DE;
  --line-2: #E8E8EC;
  --ink: #1F2023;
  --ink-2: #3B3C41;
  --muted: #6B6B72;
  --muted-2: #8E8E95;
  --draft: #B6B6BC;
  --hover: #F1F1F4;
  --select: #E4E4E9;
  --checked: #ECECF0;
  --red: #C3343F;
  --link: #2B57A6;
  --focus: #8E8E95;
}
* { box-sizing: border-box; }
/* Plain and simple: square corners on every button, window, box and badge. */
*, *::before, *::after { border-radius: 0; }
html, body { margin: 0; height: 100%; }
body { font: var(--font-ui)/1.5 var(--sans); color: var(--ink); background: var(--page); overflow: hidden; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; margin: 0; color: var(--ink); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.ic.sm { width: 14px; height: 14px; }
.ic.lg { width: 22px; height: 22px; }
.ic.fill { fill: currentColor; }
.muted { color: var(--muted); }
a { color: var(--link); }

/* ---------------- buttons and fields ---------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--line); background: var(--white); color: var(--ink); padding: 5px 14px; line-height: 1.5; font-weight: 500; white-space: nowrap; }
.btn:hover { border-color: #BDBDC3; background: var(--hover); }
.btn.primary { background: var(--charcoal); border-color: var(--charcoal); color: var(--white); }
.btn.primary:hover { background: var(--charcoal-2); border-color: var(--charcoal-2); }
.btn.danger { background: var(--red); border-color: var(--red); color: var(--white); }
.btn.danger:hover { background: #A92B35; }
.btn[disabled] { opacity: .55; cursor: default; }
.icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; border: 0; background: transparent; color: var(--ink-2); padding: 0; }
.icon-btn:hover { background: rgba(0,0,0,.07); color: var(--ink); }
.icon-btn[disabled] { opacity: .35; cursor: default; background: transparent; }
.icon-btn.xs { width: 22px; height: 22px; }
.icon-btn.xs .ic { width: 15px; height: 15px; }
.icon-btn.on { color: var(--ink); }
label { display: block; font-weight: 600; margin-bottom: 5px; }
.field { margin-bottom: 14px; }
.field .hint { font-weight: 400; color: var(--muted); margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=search], select, textarea {
  width: 100%; border: 1px solid #C9C9CF; padding: 7px 10px; background: var(--white);
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--charcoal); box-shadow: 0 0 0 2px rgba(46,47,51,.12); }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; cursor: pointer; margin: 2px 0 6px; }
.check input { width: 17px; height: 17px; margin-top: 1px; accent-color: var(--charcoal); flex: none; }
.check small { display: block; color: var(--muted); font-size: var(--font-ui); }
.error { color: var(--red); margin: 10px 0 0; }

/* ---------------- window chrome (from the "New Message" design) ---------------- */
.win { background: var(--white); box-shadow: 0 28px 50px -24px rgba(0,0,0,.45), 0 2px 6px rgba(0,0,0,.08); display: flex; flex-direction: column; overflow: hidden; }
.win-bar { display: flex; align-items: center; height: 42px; background: var(--charcoal); color: var(--white); flex: none; user-select: none; }
.win-icon { display: grid; place-items: center; width: 52px; height: 100%; border-right: 1px solid rgba(255,255,255,.55); background-clip: content-box; }
.win-icon { border-right: 0; position: relative; }
.win-icon::after { content: ""; position: absolute; right: 0; top: 11px; bottom: 11px; width: 1px; background: rgba(255,255,255,.7); }
.win-icon-r::after { left: 0; right: auto; }
.win-icon .ic { width: 20px; height: 20px; }
.win-title { flex: 1; text-align: center; font-weight: 500; letter-spacing: .01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 12px; }
.win-ctrls { display: flex; align-items: center; height: 100%; padding: 0 8px 0 12px; position: relative; gap: 2px; }
.win-ctrls::before { content: ""; position: absolute; left: 0; top: 11px; bottom: 11px; width: 1px; background: rgba(255,255,255,.7); }
.wc { display: grid; place-items: center; width: 30px; height: 30px; border: 0; background: transparent; color: var(--white); padding: 0; }
.wc:hover { background: rgba(255,255,255,.12); }
.wc .ic { width: 16px; height: 16px; }
.win-strip { background: var(--bar); padding: 9px 14px; display: flex; align-items: center; gap: 10px; flex: none; }
.win-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--bar); padding: 10px 14px; flex: none; }

/* ---------------- sign-in ---------------- */
.signin { height: 100%; display: grid; place-items: center; padding: 24px; overflow: auto; background:
  radial-gradient(ellipse at 50% 120%, rgba(0,0,0,.12), transparent 60%), var(--page); }
.login-win { width: min(460px, 100%); }
.host-pill { background: var(--white); padding: 4px 12px; flex: 1; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.login-body { padding: 28px 30px 18px; position: relative; }
.login-logo { position: absolute; top: 18px; right: 22px; width: 104px; height: auto; }
.login-body h1 { font-size: var(--font-heading); line-height: 1.15; padding-right: 110px; }
.login-body > p.muted { margin: 4px 0 22px; padding-right: 110px; }
.small-note { color: var(--muted); }
@media (max-width: 420px) { .login-logo { width: 74px; } .login-body h1, .login-body > p.muted { padding-right: 78px; } }

/* ---------------- app shell ---------------- */
.app { display: grid; height: 100%; grid-template-rows: 54px minmax(0, 1fr); grid-template-columns: 236px minmax(300px, 390px) minmax(0, 1fr); background: var(--white); }
.app > * { min-width: 0; min-height: 0; }
.top { grid-column: 1 / -1; display: flex; align-items: center; gap: 14px; background: var(--charcoal); color: var(--white); padding: 0 16px 0 18px; }
.top .icon-btn { color: var(--white); }
.top .icon-btn:hover { background: rgba(255,255,255,.12); }
.top-menu { display: none !important; }
.brand { display: flex; align-items: center; gap: 10px; width: 202px; flex: none; }
.brand .ic { width: 22px; height: 22px; }
.brand strong { display: block; font-family: var(--serif); font-size: var(--font-brand); font-weight: 600; line-height: 1.1; }
.brand small { display: block; color: #B9BAC0; font-size: var(--font-ui); line-height: 1.2; }
.search { position: relative; flex: 0 1 460px; margin-left: 40px; }
.search .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search input { border: 0; padding: 8px 14px 8px 38px; background: var(--white); color: var(--ink); }
.search input:focus { box-shadow: 0 0 0 2px rgba(255,255,255,.35); }
.user-btn { margin-left: auto; display: flex; align-items: center; gap: 6px; border: 0; background: transparent; color: var(--white); padding: 4px 6px; }
.user-btn:hover { background: rgba(255,255,255,.1); }

.avatar { --c: #6B6B72; display: inline-grid; place-items: center; width: 36px; height: 36px; background: var(--c); color: var(--white); font-weight: 600; flex: none; letter-spacing: .02em; user-select: none; }
.avatar.sm { width: 32px; height: 32px; }
.user-btn .avatar { width: 34px; height: 34px; background: var(--bar); color: var(--charcoal); }

/* ---------------- folder pane ---------------- */
.folders { background: var(--side); border-right: 1px solid var(--line); display: flex; flex-direction: column; overflow-y: auto; padding: 18px 0 12px; }
.compose-btn { margin: 0 18px 18px; padding: 9px 14px; font-weight: 600; }
.folder-list { display: flex; flex-direction: column; }
.folder { display: flex; align-items: center; gap: 12px; width: 100%; border: 0; background: transparent; text-align: left; padding: 8px 16px 8px 20px; color: var(--ink-2); position: relative; border-left: 3px solid transparent; }
.folder .ic { color: var(--muted); }
.folder:hover { background: var(--hover); }
.folder.active { background: var(--select); color: var(--ink); font-weight: 600; border-left-color: var(--charcoal); }
.folder.active .ic { color: var(--charcoal); }
.folder .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder .count { background: var(--charcoal); color: var(--white); min-width: 22px; height: 20px; padding: 0 7px; display: inline-grid; place-items: center; font-weight: 600; font-size: var(--font-ui); line-height: 1; }
.folder .total { color: var(--muted-2); font-weight: 400; }
.folder.drop-ok { outline: 2px dashed var(--charcoal); outline-offset: -3px; background: #DCDCE1; }
.folder.menu-open { background: var(--bar-2); box-shadow: inset 0 0 0 1px var(--line); }
.side-head { display: flex; align-items: center; justify-content: space-between; margin: 20px 16px 6px 23px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .07em; font-size: 12px; }
.side-head .icon-btn { color: var(--muted); }
.folder-list.custom:empty::after { content: "Right-click here or use + to add a folder."; display: block; color: var(--muted-2); padding: 2px 16px 4px 23px; }
.favs { display: flex; flex-direction: column; }
.fav { border: 0; background: transparent; text-align: left; padding: 6px 16px 6px 23px; }
.fav:hover { background: var(--hover); }
.fav b { display: block; font-weight: 500; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fav span { display: block; color: var(--muted-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.storage { margin-top: auto; padding: 16px 20px 2px 23px; color: var(--muted); }
.storage .bar { height: 5px; background: var(--bar); overflow: hidden; margin-top: 6px; }
.storage .bar i { display: block; height: 100%; background: var(--charcoal); }
.storage .bar i.full { background: var(--red); }

/* ---------------- message list ---------------- */
.list { display: flex; flex-direction: column; border-right: 1px solid var(--line); background: var(--white); }
.list-head { display: flex; align-items: flex-end; justify-content: space-between; padding: 16px 16px 10px; border-bottom: 1px solid var(--line-2); }
.list-head h2 { font-size: var(--font-subheading); line-height: 1.2; }
.list-head .muted { display: block; margin-top: 2px; }
.list-head .linklike { background: none; border: 0; padding: 0; color: var(--link); text-decoration: underline; }
.toolbar { display: flex; align-items: center; gap: 2px; padding: 5px 8px 5px 12px; background: var(--bar-2); border-bottom: 1px solid var(--line); flex: none; }
.tb-check { display: grid; place-items: center; width: 32px; height: 32px; margin: 0 4px 0 0; cursor: pointer; }
.tb-check input, .row-check input { width: 16px; height: 16px; accent-color: var(--charcoal); margin: 0; cursor: pointer; }
.tb-gap { flex: 1; }
.rows { flex: 1; overflow-y: auto; outline: none; }
.row { display: grid; grid-template-columns: 22px 36px minmax(0, 1fr); gap: 0 12px; align-items: start; padding: 12px 14px 12px 11px; border-bottom: 1px solid var(--line-2); border-left: 3px solid transparent; cursor: default; position: relative; user-select: none; }
.row:hover { background: var(--hover); }
.row.checked { background: var(--checked); }
.row.open { background: var(--select); border-left-color: var(--charcoal); }
.row.cursor { box-shadow: inset 0 0 0 1px var(--muted-2); }
.rows:focus-visible .row.open { box-shadow: inset 0 0 0 2px var(--focus); }
.row.dragging { opacity: .45; }
.row-check { display: grid; place-items: center; height: 36px; }
.row-main { min-width: 0; }
.row-top { display: flex; align-items: baseline; gap: 8px; }
.row-from { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.row-date { color: var(--muted); white-space: nowrap; flex: none; font-variant-numeric: tabular-nums; }
.row-subject { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); margin-top: 1px; }
.row-snippet { color: var(--muted); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; margin-top: 1px; }
.row.unread .row-from, .row.unread .row-subject { font-weight: 700; color: var(--ink); }
.row.unread::before { content: ""; position: absolute; left: 4px; top: 25px; width: 6px; height: 6px; background: var(--charcoal); display: none; }
.row-icons { display: inline-flex; align-items: center; gap: 4px; margin-left: 6px; color: var(--muted); flex: none; }
.row-icons .ic { width: 14px; height: 14px; }
.star-btn { display: inline-grid; place-items: center; width: 22px; height: 22px; border: 0; background: transparent; padding: 0; color: var(--muted-2); }
.star-btn:hover { color: var(--ink); background: rgba(0,0,0,.06); }
.star-btn.on { color: var(--charcoal); }
.star-btn.on .ic { fill: currentColor; }
.star-btn .ic { width: 15px; height: 15px; }
.list-note { padding: 34px 22px; text-align: center; color: var(--muted); }
.list-more { padding: 14px; text-align: center; color: var(--muted); }

/* ---------------- reading pane ---------------- */
.reader { display: flex; flex-direction: column; background: var(--white); }
.reader-empty { flex: 1; display: grid; place-items: center; color: var(--muted); text-align: center; padding: 24px; }
.reader-empty .ic { width: 46px; height: 46px; stroke-width: 1.2; color: var(--draft); margin-bottom: 10px; }
.r-head { display: flex; gap: 14px; align-items: flex-start; padding: 18px 22px 14px; border-bottom: 1px solid var(--line-2); }
.r-back { display: none !important; margin: 2px -4px 0 -8px; }
.r-who { flex: 1; min-width: 0; }
.r-who .line { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.r-who .k { color: var(--muted); display: inline-block; min-width: 40px; margin-right: 4px; }
.r-who b { font-weight: 600; }
.r-acts { display: flex; gap: 2px; margin-right: -6px; }
.r-acts .on .ic { fill: currentColor; color: var(--charcoal); }
.r-title { padding: 16px 22px 4px; }
.r-title h1 { font-size: var(--font-subheading); line-height: 1.3; overflow-wrap: anywhere; }
.r-title .muted { margin-top: 3px; }
.r-banner { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 10px 22px 0; padding: 7px 12px; background: var(--bar-2); border: 1px solid var(--line); color: var(--ink-2); }
.r-banner .btn { padding: 2px 10px; }
.r-frame { flex: 1; min-height: 120px; width: 100%; border: 0; display: block; background: var(--white); }
.r-files { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 22px; border-top: 1px solid var(--line-2); }
.file { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); padding: 5px 10px; max-width: 280px; color: var(--ink); text-decoration: none; background: var(--white); }
.file:hover { background: var(--hover); }
.file .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file .size { color: var(--muted); white-space: nowrap; }
.file .x { border: 0; background: transparent; padding: 0 0 0 2px; color: var(--muted); display: grid; place-items: center; }
.file .x:hover { color: var(--red); }
.r-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 22px 16px; border-top: 1px solid var(--line-2); }
.r-foot .btn { min-width: 104px; }

/* ---------------- compose window ---------------- */
.compose { position: fixed; right: 24px; bottom: 0; width: 620px; height: min(560px, calc(100vh - 70px)); z-index: 30; }
.compose.max { right: 50%; bottom: 50%; transform: translate(50%, 50%); width: min(1100px, calc(100vw - 48px)); height: calc(100vh - 48px); }
.compose.min { height: 42px; width: 340px; }
.compose.min .compose-body, .compose.min .compose-foot { display: none; }
.compose .win-bar { cursor: default; }
.compose.min .win-bar { cursor: pointer; }
.compose-body { flex: 1; display: flex; flex-direction: column; min-height: 0; position: relative; }
.compose-body.drop-on::after { content: "Drop files to attach them"; position: absolute; inset: 6px; border: 2px dashed var(--charcoal); background: rgba(255,255,255,.88); display: grid; place-items: center; font-weight: 600; z-index: 3; }
.c-row { display: flex; align-items: center; gap: 8px; padding: 0 14px; min-height: 40px; border-bottom: 1px solid var(--line); flex: none; }
.c-row label { margin: 0; font-weight: 400; color: var(--ink-2); white-space: nowrap; min-width: 58px; }
.c-row input, .c-row select { border: 0; padding: 9px 0; box-shadow: none !important; background: transparent; }
.c-row select { width: auto; flex: 1; }
.pills { display: flex; gap: 8px; flex: none; }
.pill { border: 1px solid var(--line); background: var(--white); padding: 1px 9px; color: var(--ink-2); }
.pill:hover { background: var(--hover); }
.pill.on { background: var(--bar); }
.fmt { display: flex; align-items: center; gap: 2px; padding: 4px 10px; border-bottom: 1px solid var(--line); background: var(--bar-2); flex: none; flex-wrap: wrap; }
.fmt button { min-width: 30px; height: 28px; border: 0; background: transparent; display: inline-grid; place-items: center; color: var(--ink-2); padding: 0 6px; }
.fmt button:hover, .fmt button.on { background: rgba(0,0,0,.08); color: var(--ink); }
.fmt select { width: auto; padding: 3px 6px; height: 28px; border-color: var(--line); }
.fmt-sep { width: 1px; height: 18px; background: var(--line); margin: 0 6px; }
.fmt-color { display: inline-flex; align-items: center; gap: 4px; margin: 0 4px; font-weight: 700; cursor: pointer; }
.fmt-color input { width: 22px; height: 22px; padding: 0; border: 1px solid var(--line); background: none; cursor: pointer; }
.editor { flex: 1; overflow-y: auto; padding: 14px 16px; outline: none; line-height: 1.5; overflow-wrap: anywhere; min-height: 80px; }
.editor:empty::before { content: attr(data-placeholder); color: var(--muted-2); }
.editor p { margin: 0; }
.editor blockquote { margin: 0 0 0 .8ex; border-left: 2px solid #C9C9CE; padding-left: 1ex; }
.editor img { max-width: 100%; height: auto; }
.editor .fcm-signature { color: var(--ink-2); }
.c-files { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 14px; border-top: 1px solid var(--line-2); max-height: 96px; overflow-y: auto; flex: none; }
.c-error { margin: 0; padding: 8px 14px; background: #FBEDEE; color: var(--red); border-top: 1px solid #EBC5C9; flex: none; }
.compose-foot { padding: 9px 14px; }
.c-tools, .c-actions { display: flex; align-items: center; gap: 4px; }
.c-actions { gap: 12px; }
.tool { display: inline-grid; place-items: center; min-width: 36px; height: 36px; border: 0; background: transparent; color: var(--ink); padding: 0 4px; }
.tool:hover, .tool[aria-pressed="true"] { background: rgba(0,0,0,.08); }
.tool .ic { width: 22px; height: 22px; stroke-width: 1.6; }
.tool.aa { font-size: 22px; line-height: 1; font-weight: 400; letter-spacing: -.02em; }
.btn.send { background: var(--charcoal); border-color: var(--charcoal); color: var(--white); min-width: 100px; padding: 6px 16px; }
.btn.send:hover { background: var(--charcoal-2); }
.btn.draft { background: var(--draft); border-color: var(--draft); color: var(--white); min-width: 100px; padding: 6px 16px; }
.btn.draft:hover { background: #A5A5AC; }

/* ---------------- menus, popovers, dialogs ---------------- */
.menu { position: fixed; z-index: 60; min-width: 220px; background: var(--white); border: 1px solid var(--line); box-shadow: 0 16px 34px -14px rgba(0,0,0,.35); padding: 5px; max-height: calc(100vh - 16px); overflow-y: auto; }
.menu .mi { display: flex; align-items: center; gap: 11px; width: 100%; border: 0; background: transparent; text-align: left; padding: 7px 12px 7px 10px; color: var(--ink); white-space: nowrap; }
.menu .mi .ic { color: var(--ink-2); }
.menu .mi:hover:not([disabled]), .menu .mi:focus-visible, .menu .mi.hot { background: var(--bar-2); outline: none; }
.menu .mi[disabled] { color: var(--muted-2); cursor: default; }
.menu .mi[disabled] .ic { color: var(--draft); }
.menu .mi .lbl { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.menu .mi .sub-ic { width: 14px; height: 14px; color: var(--muted); margin-right: -4px; }
.menu .mi.check-on .tick { visibility: visible; }
.menu .tick { visibility: hidden; }
.menu .sep { height: 1px; background: var(--line-2); margin: 5px 6px; }
.menu .mh { padding: 6px 12px 4px; color: var(--muted); font-weight: 600; }
.menu .mi.indent1 { padding-left: 26px; } .menu .mi.indent2 { padding-left: 42px; } .menu .mi.indent3 { padding-left: 58px; }
.pop { position: fixed; z-index: 55; background: var(--white); border: 1px solid var(--line); box-shadow: 0 16px 34px -14px rgba(0,0,0,.35); padding: 10px; }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 34px); gap: 2px; }
.emoji-grid button { width: 34px; height: 34px; border: 0; background: transparent; font-size: 20px; line-height: 1; padding: 0; }
.emoji-grid button:hover { background: var(--bar-2); }
.link-pop { width: 320px; }
.link-pop .field { margin-bottom: 10px; }
.link-pop .acts { display: flex; justify-content: flex-end; gap: 8px; }
.suggest { position: fixed; z-index: 58; background: var(--white); border: 1px solid var(--line); box-shadow: 0 16px 34px -14px rgba(0,0,0,.35); padding: 4px; max-height: 260px; overflow-y: auto; min-width: 280px; }
.suggest .opt { display: flex; gap: 10px; align-items: center; padding: 6px 10px; cursor: pointer; }
.suggest .opt.hot, .suggest .opt:hover { background: var(--bar-2); }
.suggest .opt .avatar { width: 28px; height: 28px; font-size: 12px; }
.suggest .opt div b { display: block; font-weight: 500; }
.suggest .opt div span { display: block; color: var(--muted); }

dialog.dlg { border: 0; padding: 0; width: min(440px, calc(100vw - 32px)); color: var(--ink); }
dialog.dlg[open] { display: flex; }
dialog.dlg::backdrop { background: rgba(30,31,35,.45); }
dialog.dlg form { display: flex; flex-direction: column; width: 100%; }
.dlg-body { padding: 20px 22px 8px; }
.dlg-body p { margin: 0 0 14px; }
.dlg-body .warn { color: var(--ink-2); }

.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 70; background: var(--charcoal); color: var(--white); padding: 10px 18px; box-shadow: 0 10px 30px -10px rgba(0,0,0,.45); max-width: min(560px, calc(100vw - 32px)); display: flex; gap: 16px; align-items: center; }
.toast.err { background: var(--red); }
.toast button { background: none; border: 0; color: #DADADF; text-decoration: underline; padding: 0; }
.drag-ghost { position: fixed; top: -100px; left: -400px; background: var(--charcoal); color: var(--white); padding: 6px 12px; font-weight: 600; white-space: nowrap; display: flex; gap: 8px; align-items: center; }

@media (prefers-reduced-motion: no-preference) {
  .toast { animation: rise .18s ease-out; }
  .menu, .pop, .suggest { animation: fade .1s ease-out; }
}
@keyframes rise { from { opacity: 0; transform: translate(-50%, 8px); } }
@keyframes fade { from { opacity: 0; } }

/* ---------------- smaller screens ---------------- */
@media (max-width: 1180px) {
  .app { grid-template-columns: 210px minmax(280px, 330px) minmax(0, 1fr); }
  .brand { width: 176px; }
  .search { margin-left: 18px; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .top-menu { display: inline-grid !important; }
  .brand { width: auto; }
  .brand small { display: none; }
  .search { margin-left: 0; flex: 1; }
  .folders { position: fixed; top: 54px; bottom: 0; left: 0; width: 270px; z-index: 40; box-shadow: 18px 0 40px -20px rgba(0,0,0,.4); transform: translateX(-105%); transition: transform .18s ease-out; }
  .app.nav-open .folders { transform: none; }
  .list { grid-column: 1; grid-row: 2; border-right: 0; }
  .reader { grid-column: 1; grid-row: 2; display: none; }
  .app.reading .list { display: none; }
  .app.reading .reader { display: flex; }
  .r-back { display: inline-grid !important; }
  .compose, .compose.max { inset: 0; transform: none; width: auto; height: auto; }
  .compose.min { inset: auto 0 0 auto; width: 300px; height: 42px; }
}
@media (max-width: 520px) {
  .brand strong { font-size: 17px; }
  .brand .ic { display: none; }
  .r-foot .btn { min-width: 0; flex: 1; }
  .compose-foot { flex-wrap: wrap; }
  .c-actions { margin-left: auto; }
}
@media (max-width: 430px) {
  .brand { display: none; }
  .top { gap: 8px; padding: 0 10px; }
}
@media print {
  body { overflow: visible; background: var(--white); }
}
