/* ListGoMail — Gmail-style webmail for ListGOPH mailboxes. Plain CSS, no build step. */

:root {
    --bg: #f6f8fc;
    --surface: #ffffff;
    --surface-read: #f2f6fc;
    --surface-alt: #f8fafd;
    --text: #1f1f1f;
    --text-2: #444746;
    --text-3: #5e5e5e;
    --muted: #747775;
    --line: #e3e3e3;
    --row-line: rgba(100, 121, 143, 0.12);
    --accent: #0b57d0;
    --accent-hover: #0a4fbd;
    --accent-ink: #ffffff;
    --accent-soft: #d3e3fd;
    --pill: #c2e7ff;
    --pill-ink: #001d35;
    --compose: #c2e7ff;
    --compose-ink: #001d35;
    --hover: rgba(68, 71, 70, 0.08);
    --press: rgba(68, 71, 70, 0.14);
    --selected: #c2dbff;
    --search: #e9eef6;
    --chip: #e8eaed;
    --chip-ink: #3c4043;
    --star: #f4b400;
    --danger: #b3261e;
    --danger-soft: #fce8e6;
    --ok: #146c2e;
    --ok-soft: #e6f4ea;
    --toast: #303030;
    --toast-ink: #f2f2f2;
    --toast-link: #a8c7fa;
    --compose-head: #f2f6fc;
    --menu: #ffffff;
    --scrim: rgba(32, 33, 36, 0.45);
    --focus: #0b57d0;
    --row-hover-shadow: inset 1px 0 0 #dadce0, inset -1px 0 0 #dadce0, 0 1px 2px 0 rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);
    --shadow-1: 0 1px 2px 0 rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);
    --shadow-2: 0 1px 3px 0 rgba(60, 64, 67, 0.3), 0 4px 8px 3px rgba(60, 64, 67, 0.15);
    --shadow-3: 0 8px 10px 1px rgba(0, 0, 0, 0.14), 0 3px 14px 2px rgba(0, 0, 0, 0.12), 0 5px 5px -3px rgba(0, 0, 0, 0.2);
    --av-0: #1a73e8; --av-1: #d93025; --av-2: #188038; --av-3: #e37400;
    --av-4: #9334e6; --av-5: #007b83; --av-6: #c5221f; --av-7: #5f6368;

    --font: Roboto, "Helvetica Neue", Arial, system-ui, sans-serif;
    --font-display: Inter, Roboto, "Helvetica Neue", Arial, system-ui, sans-serif;
    --topbar-h: 64px;
    --sidebar-w: 256px;
    --radius: 16px;
    --ease: cubic-bezier(0.2, 0, 0, 1);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #1b1c1e;
        --surface: #242528;
        --surface-read: #1f2023;
        --surface-alt: #2a2b2e;
        --text: #e3e3e3;
        --text-2: #c4c7c5;
        --text-3: #a8abae;
        --muted: #8e918f;
        --line: #3c3d40;
        --row-line: rgba(255, 255, 255, 0.07);
        --accent: #a8c7fa;
        --accent-hover: #c2d7fb;
        --accent-ink: #062e6f;
        --accent-soft: #0842a0;
        --pill: #004a77;
        --pill-ink: #c2e7ff;
        --compose: #004a77;
        --compose-ink: #c2e7ff;
        --hover: rgba(227, 227, 227, 0.08);
        --press: rgba(227, 227, 227, 0.14);
        --selected: #2b3d5c;
        --search: #2f3033;
        --chip: #3c3d40;
        --chip-ink: #e3e3e3;
        --star: #fdd663;
        --danger: #f2b8b5;
        --danger-soft: #3d2322;
        --ok: #6dd58c;
        --ok-soft: #1c3324;
        --toast: #e3e3e3;
        --toast-ink: #1f1f1f;
        --toast-link: #0b57d0;
        --compose-head: #2f3033;
        --menu: #2d2e31;
        --scrim: rgba(0, 0, 0, 0.6);
        --focus: #a8c7fa;
        --row-hover-shadow: inset 1px 0 0 #4a4b4e, inset -1px 0 0 #4a4b4e, 0 1px 2px 0 rgba(0, 0, 0, 0.6), 0 1px 3px 1px rgba(0, 0, 0, 0.3);
        --shadow-1: 0 1px 2px 0 rgba(0, 0, 0, 0.5), 0 1px 3px 1px rgba(0, 0, 0, 0.3);
        --shadow-2: 0 1px 3px 0 rgba(0, 0, 0, 0.5), 0 4px 8px 3px rgba(0, 0, 0, 0.3);
        --shadow-3: 0 8px 10px 1px rgba(0, 0, 0, 0.4), 0 3px 14px 2px rgba(0, 0, 0, 0.35), 0 5px 5px -3px rgba(0, 0, 0, 0.5);
    }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 400 14px/20px var(--font);
    -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
img { max-width: 100%; }
kbd {
    display: inline-block;
    min-width: 22px;
    padding: 1px 6px;
    border: 1px solid var(--line);
    border-bottom-width: 2px;
    border-radius: 6px;
    background: var(--surface-alt);
    font: 500 12px/18px var(--font);
    text-align: center;
    color: var(--text);
}
code { font-size: 13px; background: var(--surface-alt); padding: 0 4px; border-radius: 4px; }
.sr-only {
    position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.msi {
    font-family: "Material Symbols Outlined";
    font-weight: normal;
    font-style: normal;
    font-size: 20px;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    font-feature-settings: "liga";
    -webkit-font-smoothing: antialiased;
    font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 20;
    user-select: none;
    flex-shrink: 0;
}

.skip-link {
    position: absolute; left: 8px; top: -48px; z-index: 100;
    background: var(--accent); color: var(--accent-ink);
    padding: 8px 16px; border-radius: 8px; text-decoration: none;
}
.skip-link:focus { top: 8px; }

/* ---------- Buttons ---------- */
.icon-btn {
    position: relative;
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--text-2);
    text-decoration: none;
    flex-shrink: 0;
    transition: background-color 0.15s;
}
.icon-btn:hover { background: var(--hover); }
.icon-btn:active { background: var(--press); }
.icon-btn.is-disabled { opacity: 0.38; pointer-events: none; }
.icon-btn-lg .msi { font-size: 24px; font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24; }
.icon-btn-sm { width: 32px; height: 32px; }
.icon-btn-sm .msi { font-size: 18px; }

.btn-filled, .btn-text, .btn-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 40px;
    padding: 0 24px;
    border-radius: 20px;
    font: 500 14px/20px var(--font-display);
    letter-spacing: 0.1px;
    text-decoration: none;
    border: 0;
    white-space: nowrap;
    transition: background-color 0.15s, box-shadow 0.15s;
}
.btn-filled { background: var(--accent); color: var(--accent-ink); }
.btn-filled:hover { background: var(--accent-hover); box-shadow: var(--shadow-1); }
.btn-filled:disabled { opacity: 0.6; cursor: default; box-shadow: none; }
.btn-text { background: transparent; color: var(--accent); padding: 0 12px; }
.btn-text:hover { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.btn-outline {
    height: 36px;
    padding: 0 24px 0 16px;
    border: 1px solid var(--muted);
    background: transparent;
    color: var(--text-2);
}
.btn-outline:hover { background: var(--hover); }
.btn-outline .msi { font-size: 20px; }
.link-btn {
    border: 0; background: none; padding: 0;
    color: var(--accent); font-weight: 500; text-decoration: none;
}
.link-btn:hover { text-decoration: underline; }

.cb {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--accent);
    cursor: pointer;
}

/* ---------- Avatars ---------- */
.avatar {
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--av-7);
    color: #fff;
    font: 500 18px/1 var(--font-display);
    flex-shrink: 0;
    user-select: none;
}
.avatar-sm { width: 32px; height: 32px; font-size: 15px; }
.avatar-lg { width: 80px; height: 80px; font-size: 36px; }
.av-0 { background: var(--av-0); } .av-1 { background: var(--av-1); }
.av-2 { background: var(--av-2); } .av-3 { background: var(--av-3); }
.av-4 { background: var(--av-4); } .av-5 { background: var(--av-5); }
.av-6 { background: var(--av-6); } .av-7 { background: var(--av-7); }

/* ---------- App frame ---------- */
body.app {
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.topbar {
    height: var(--topbar-h);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    padding: 8px 8px 8px 8px;
    gap: 8px;
}
.topbar-left {
    display: flex;
    align-items: center;
    gap: 4px;
    width: calc(var(--sidebar-w) - 16px);
    flex-shrink: 0;
    padding-left: 4px;
}
.brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 8px 0 4px;
    height: 48px;
    color: var(--text-2);
    text-decoration: none;
    border-radius: 8px;
}
.brand-mark { width: 34px; height: 34px; display: block; }
.brand-name {
    font: 400 22px/24px var(--font-display);
    letter-spacing: -0.4px;
    color: var(--text-2);
}

.search {
    flex: 1 1 auto;
    max-width: 720px;
    height: 48px;
    display: flex;
    align-items: center;
    background: var(--search);
    border-radius: 24px;
    padding: 0 4px;
    transition: background-color 0.15s, box-shadow 0.15s;
}
.search:focus-within { background: var(--surface); box-shadow: var(--shadow-1); }
.search input {
    flex: 1;
    min-width: 0;
    height: 100%;
    border: 0;
    background: transparent;
    font-size: 16px;
    padding: 0 8px 0 4px;
}
.search input::placeholder { color: var(--text-2); }
.search input::-webkit-search-cancel-button { display: none; }
.search input:focus-visible { outline: none; }
.search .icon-btn .msi { font-size: 24px; font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24; }

.topbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 4px;
    padding-right: 4px;
}
.avatar-btn {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border: 0;
    padding: 0;
    border-radius: 50%;
    background: transparent;
}
.avatar-btn:hover { background: var(--hover); }

.shell {
    flex: 1;
    display: flex;
    min-height: 0;
    position: relative;
}

/* ---------- Sidebar ---------- */
.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    overflow-x: hidden;
    overflow-y: auto;
    padding-bottom: 16px;
    display: flex;
    flex-direction: column;
    transition: width 0.2s var(--ease);
    scrollbar-width: thin;
}
.compose-btn {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    align-self: flex-start;
    height: 56px;
    min-width: 56px;
    margin: 8px 0 16px 8px;
    padding: 0 20px 0 16px;
    border: 0;
    border-radius: 16px;
    background: var(--compose);
    color: var(--compose-ink);
    font: 500 14px/20px var(--font-display);
    letter-spacing: 0.25px;
    transition: box-shadow 0.15s var(--ease), padding 0.2s var(--ease);
}
.compose-btn:hover { box-shadow: var(--shadow-2); }
.compose-btn .msi { font-size: 24px; font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24; }

.nav-list { list-style: none; margin: 0; padding: 0; }
.nav-item {
    display: flex;
    align-items: center;
    gap: 18px;
    height: 32px;
    margin-right: 16px;
    padding: 0 12px 0 26px;
    border-radius: 0 16px 16px 0;
    color: var(--text-2);
    text-decoration: none;
    font-size: 14px;
    letter-spacing: 0.2px;
    white-space: nowrap;
    transition: background-color 0.1s;
}
.nav-item:hover { background: var(--hover); }
.nav-item.is-active { background: var(--pill); color: var(--pill-ink); font-weight: 700; }
.nav-item.is-active .nav-icon { font-variation-settings: "FILL" 1, "wght" 400, "GRAD" 0, "opsz" 20; }
.nav-item:focus-visible { outline-offset: -2px; }
.nav-label { overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1; }
.nav-count { margin-left: auto; font-size: 12px; letter-spacing: 0.3px; }
.nav-item.has-unread { font-weight: 700; color: var(--text); }
.nav-item.is-active.has-unread { color: var(--pill-ink); }
.nav-heading {
    display: flex;
    align-items: center;
    height: 40px;
    margin-top: 12px;
    padding: 0 16px 0 26px;
    font: 500 16px/24px var(--font-display);
    color: var(--text);
}
.sidebar-foot {
    margin-top: auto;
    padding: 24px 16px 0 26px;
    font-size: 12px;
    color: var(--muted);
    white-space: nowrap;
}

/* Desktop collapsed rail (hamburger) */
@media (min-width: 768px) {
    body.nav-collapsed { --sidebar-w: 72px; }
    body.nav-collapsed .topbar-left { width: 240px; }
    body.nav-collapsed .sidebar .nav-label,
    body.nav-collapsed .sidebar .nav-count,
    body.nav-collapsed .sidebar .compose-btn-label,
    body.nav-collapsed .sidebar-foot { display: none; }
    body.nav-collapsed .compose-btn { padding: 0 16px; }
    body.nav-collapsed .nav-item {
        width: 56px;
        margin-left: 8px;
        margin-right: 0;
        padding: 0 18px;
        border-radius: 16px;
        position: relative;
    }
    body.nav-collapsed .nav-item.has-unread::after {
        content: "";
        position: absolute;
        top: 6px;
        right: 14px;
        width: 7px;
        height: 7px;
        border-radius: 50%;
        background: var(--danger);
    }
    body.nav-collapsed .nav-heading { height: 1px; margin: 12px 16px; padding: 0; background: var(--line); }
}

/* ---------- Main surface ---------- */
.surface {
    flex: 1;
    min-width: 0;
    background: var(--surface);
    border-radius: var(--radius);
    margin: 0 16px 16px 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}
.surface > section { flex: 1; min-height: 0; display: flex; flex-direction: column; }

.toolbar {
    height: 48px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px 0 4px;
    gap: 8px;
    border-bottom: 1px solid transparent;
}
.tb-left, .tb-right, .tb-group { display: flex; align-items: center; min-width: 0; }
.tb-group { gap: 2px; }
.tb-left { gap: 4px; }
.tb-sep { width: 1px; height: 20px; background: var(--line); margin: 0 8px; }
.tb-count { margin-left: 12px; font-size: 13px; color: var(--text-2); white-space: nowrap; }
.cb-cell {
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 50%;
}
.toolbar .cb-cell:hover { background: var(--hover); }
.pager { gap: 0; color: var(--text-2); font-size: 12px; }
.pager-text { margin-right: 8px; white-space: nowrap; color: var(--text-2); font-size: 12px; letter-spacing: 0.3px; }
.pager-text strong { font-weight: 500; }
.pager .icon-btn { width: 36px; height: 36px; }

/* ---------- Message list ---------- */
.list-scroll { flex: 1; min-height: 0; overflow-y: auto; position: relative; scrollbar-width: thin; }
.rows { border-top: 1px solid var(--row-line); }

.mrow {
    position: relative;
    display: flex;
    align-items: center;
    height: 40px;
    padding: 0 16px 0 6px;
    border-bottom: 1px solid var(--row-line);
    background: var(--surface-read);
    color: var(--text-2);
    cursor: pointer;
    font-size: 14px;
    letter-spacing: 0.2px;
}
.mrow.is-unread { background: var(--surface); color: var(--text); }
.mrow:hover { box-shadow: var(--row-hover-shadow); z-index: 2; }
.mrow.is-selected { background: var(--selected); }
.mrow.is-cursor::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--accent);
}
.mrow:has(.mrow-link:focus-visible) { outline: 2px solid var(--focus); outline-offset: -2px; z-index: 3; }
.mrow.is-leaving {
    transition: opacity 0.2s, height 0.2s var(--ease), border-color 0.2s;
    opacity: 0;
    height: 0;
    border-bottom-color: transparent;
    overflow: hidden;
}

.mrow .cb-cell { width: 34px; height: 34px; }
.mrow .cb-cell:hover { background: var(--hover); }
.star-btn {
    display: inline-grid;
    place-items: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--muted);
    flex-shrink: 0;
}
.star-btn:hover { background: var(--hover); color: var(--text); }
.star-btn.is-on { color: var(--star); }
.star-btn.is-on .msi { font-variation-settings: "FILL" 1, "wght" 400, "GRAD" 0, "opsz" 20; }
.star-btn.is-popping .msi { animation: star-pop 0.3s var(--ease); }
@keyframes star-pop { 50% { transform: scale(1.35); } }

.mrow-link {
    flex: 1;
    min-width: 0;
    height: 100%;
    display: flex;
    align-items: center;
    padding-left: 6px;
    color: inherit;
    text-decoration: none;
}
.mrow-link:focus-visible { outline: none; }
.cell-from {
    flex: 0 0 200px;
    padding-right: 32px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.cell-main {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.subj { color: var(--text); }
.snip { color: var(--text-3); }
.mrow.is-unread .cell-from,
.mrow.is-unread .subj,
.mrow.is-unread .cell-date { font-weight: 700; color: var(--text); }
.cell-att { display: inline-flex; color: var(--muted); padding-left: 12px; }
.cell-att .msi { font-size: 18px; transform: rotate(45deg); }
.cell-date {
    flex: 0 0 auto;
    min-width: 72px;
    padding-left: 16px;
    text-align: right;
    font-size: 12px;
    letter-spacing: 0.3px;
    white-space: nowrap;
}
.draft-tag { color: var(--danger); font-weight: 400; margin-right: 2px; }
.mrow.is-unread .draft-tag { font-weight: 700; }
.label-chip {
    display: inline-block;
    vertical-align: 1px;
    margin-right: 6px;
    padding: 0 6px;
    border-radius: 4px;
    background: var(--chip);
    color: var(--chip-ink);
    font: 400 12px/18px var(--font);
    text-decoration: none;
    font-weight: 400 !important;
}
.label-chip-lg { font-size: 12px; line-height: 20px; padding: 0 6px; margin: 0 0 0 10px; }
a.label-chip-lg:hover { filter: brightness(0.95); }

.row-actions {
    position: absolute;
    right: 8px;
    top: 0;
    bottom: 0;
    display: none;
    align-items: center;
    gap: 0;
    padding-left: 8px;
    background: inherit;
}
.row-actions .icon-btn { width: 36px; height: 36px; }
@media (hover: hover) {
    .mrow:hover .row-actions { display: flex; }
    .mrow:hover .cell-date, .mrow:hover .cell-att { visibility: hidden; }
}

.search-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 16px 10px 20px;
    color: var(--text-2);
    font-size: 13px;
}

.empty {
    text-align: center;
    padding: 72px 24px;
    color: var(--text-2);
}
.empty-icon {
    font-size: 64px;
    font-variation-settings: "FILL" 0, "wght" 300, "GRAD" 0, "opsz" 24;
    color: var(--muted);
    margin-bottom: 12px;
}
.empty-title { font: 400 18px/24px var(--font-display); color: var(--text); margin: 0 0 6px; }
.empty-sub { margin: 0 auto; max-width: 420px; color: var(--text-3); }

.new-pill {
    position: absolute;
    top: 56px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 16px 0 12px;
    border: 0;
    border-radius: 18px;
    background: var(--accent);
    color: var(--accent-ink);
    font: 500 14px/20px var(--font-display);
    box-shadow: var(--shadow-2);
    animation: pill-in 0.25s var(--ease);
}
@keyframes pill-in { from { opacity: 0; transform: translate(-50%, -8px); } }

/* Mobile compose button (shown under 768px) */
.fab {
    display: none;
    position: fixed;
    right: 16px;
    bottom: 20px;
    z-index: 50;
    align-items: center;
    gap: 12px;
    height: 56px;
    padding: 0 20px 0 16px;
    border: 0;
    border-radius: 16px;
    background: var(--compose);
    color: var(--compose-ink);
    font: 500 14px/20px var(--font-display);
    box-shadow: var(--shadow-2);
}
.fab .msi { font-size: 24px; }

/* ---------- Menus ---------- */
.menu-wrap { position: relative; display: inline-flex; }
.menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    z-index: 30;
    min-width: 200px;
    max-height: 60vh;
    overflow-y: auto;
    padding: 8px 0;
    border-radius: 8px;
    background: var(--menu);
    box-shadow: var(--shadow-2);
    animation: menu-in 0.12s var(--ease);
}
@keyframes menu-in { from { opacity: 0; transform: translateY(-4px); } }
.menu-right, .account-menu { left: auto; right: 0; }
.menu-title { padding: 6px 16px 8px; font-size: 13px; color: var(--text-3); }
.menu-item {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    min-height: 36px;
    padding: 0 20px 0 16px;
    border: 0;
    background: transparent;
    color: var(--text);
    text-align: left;
    text-decoration: none;
    font-size: 14px;
    white-space: nowrap;
}
.menu-item:hover, .menu-item:focus-visible { background: var(--hover); outline: none; }
.menu-item .msi { color: var(--text-2); }
.account-menu {
    width: 340px;
    border-radius: 28px;
    padding: 16px 8px 12px;
    background: var(--compose-head);
}
.account-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 16px 20px;
    text-align: center;
}
.account-card .avatar { margin-bottom: 8px; }
.account-hi { font: 400 22px/28px var(--font-display); color: var(--text); }
.account-email { color: var(--text-2); font-size: 14px; word-break: break-all; }
.account-menu .menu-item { border-radius: 20px; height: 44px; padding: 0 20px; background: var(--surface); margin-top: 4px; }
.account-menu .menu-item:hover { background: var(--hover); }

/* ---------- Conversation ---------- */
.conv-scroll { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: thin; }
.conv-head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    padding: 16px 16px 12px 72px;
}
.conv-subject {
    margin: 0;
    font: 400 22px/28px var(--font-display);
    color: var(--text);
    word-break: break-word;
}
.thread { padding-bottom: 8px; }
.msg { border-bottom: 1px solid var(--row-line); }
.msg:last-child { border-bottom: 0; }
.msg-head {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr) auto;
    column-gap: 16px;
    align-items: start;
    padding: 12px 16px 8px;
    cursor: pointer;
}
.msg-head:focus-visible { outline-offset: -2px; border-radius: 8px; }
.msg-who { min-width: 0; padding-top: 2px; }
.msg-line1 { display: flex; align-items: baseline; gap: 4px; flex-wrap: wrap; min-width: 0; }
.msg-name { font-weight: 700; font-size: 14px; color: var(--text); }
.msg-email { font-size: 12px; color: var(--text-3); }
.msg-to { display: flex; align-items: center; font-size: 12px; color: var(--text-3); min-height: 20px; }
.details-btn {
    display: inline-grid;
    place-items: center;
    width: 20px;
    height: 20px;
    margin-left: 2px;
    padding: 0;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: var(--text-3);
}
.details-btn:hover { background: var(--hover); }
.msg-snippet {
    display: none;
    font-size: 14px;
    color: var(--text-3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.msg-meta { display: flex; align-items: center; gap: 2px; color: var(--text-3); font-size: 12px; white-space: nowrap; }
.msg-date { margin-right: 8px; letter-spacing: 0.2px; }
.msg-clip { font-size: 18px; transform: rotate(45deg); margin-right: 6px; }
.msg-meta .icon-btn { width: 36px; height: 36px; }

.msg:not(.is-open) .msg-head { padding-bottom: 12px; }
.msg:not(.is-open) .msg-to,
.msg:not(.is-open) .msg-content,
.msg:not(.is-open) .msg-details,
.msg:not(.is-open) .msg-only-open,
.msg:not(.is-open) .msg-ago,
.msg:not(.is-open) .msg-email { display: none !important; }
.msg:not(.is-open) .msg-snippet { display: block; }
.msg:not(.is-open):hover { background: var(--surface-alt); }

.msg-details {
    margin: 0 16px 8px 72px;
    padding: 12px 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 12px;
    color: var(--text-2);
    width: fit-content;
    max-width: calc(100% - 88px);
}
.msg-details dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; }
.msg-details dt { color: var(--text-3); text-align: right; }
.msg-details dd { margin: 0; word-break: break-word; }

.msg-content { padding: 0 16px 16px 72px; }
.msg-images {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
    align-items: center;
    margin: 4px 0 12px;
    padding: 10px 14px;
    border-radius: 8px;
    background: var(--surface-alt);
    font-size: 13px;
    color: var(--text-2);
}
.msg-bodywrap {
    border-radius: 8px;
    overflow: hidden;
}
.msg-body {
    display: block;
    width: 100%;
    height: 80px;
    border: 0;
    background: #fff;
    /* The frame's own prefers-color-scheme follows this: plain-text mail goes dark with the app,
       HTML mail keeps its white canvas (MessageReader::document). */
    color-scheme: light dark;
    transition: height 0.12s;
}
.msg.is-draft .msg-name { color: var(--text); }

.msg-atts { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--row-line); }
.atts-title { font: 500 14px/20px var(--font-display); color: var(--text-2); margin-bottom: 12px; }
.att-grid { display: flex; flex-wrap: wrap; gap: 12px; }
.att-card {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 180px;
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
    color: var(--text);
    text-decoration: none;
    background: var(--surface);
    transition: box-shadow 0.15s;
}
.att-card:hover { box-shadow: var(--shadow-1); }
.att-thumb {
    display: grid;
    place-items: center;
    height: 100px;
    background: var(--surface-alt);
    color: var(--text-3);
    overflow: hidden;
}
.att-thumb img { width: 100%; height: 100%; object-fit: cover; }
.att-thumb .msi { font-size: 40px; font-variation-settings: "FILL" 0, "wght" 300, "GRAD" 0, "opsz" 24; }
.att-info { display: flex; flex-direction: column; padding: 8px 12px 10px; min-width: 0; }
.att-name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 20px; }
.att-size { font-size: 12px; color: var(--text-3); }
.att-dl { position: absolute; right: 10px; bottom: 12px; font-size: 18px; color: var(--text-3); opacity: 0; transition: opacity 0.15s; }
.att-card:hover .att-dl, .att-card:focus-visible .att-dl { opacity: 1; }

.conv-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px 16px 40px 72px;
}

/* ---------- Settings ---------- */
.settings-title { margin: 0 0 0 4px; font: 400 22px/28px var(--font-display); }
.settings-scroll { flex: 1; min-height: 0; overflow-y: auto; }
.settings-form { max-width: 920px; padding: 8px 24px 40px; }
.set-row {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 8px 32px;
    padding: 20px 0;
    border-bottom: 1px solid var(--row-line);
}
.set-name { font-weight: 500; color: var(--text); }
.set-static { padding: 8px 0; font-size: 14px; }
.set-help { margin: 8px 0 0; color: var(--text-3); font-size: 13px; max-width: 60ch; }
.set-help-flush { margin-top: 0; margin-bottom: 8px; }
.text-input {
    width: 100%;
    max-width: 520px;
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--muted);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font-size: 14px;
}
.text-input:focus { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); outline: none; }
.text-input.is-invalid { border-color: var(--danger); }
.textarea { height: auto; padding: 10px 12px; line-height: 20px; resize: vertical; font-family: var(--font); }
.settings-actions { display: flex; gap: 8px; padding-top: 24px; }
.notice {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 12px 0 4px;
    padding: 10px 14px;
    border-radius: 8px;
    background: var(--ok-soft);
    color: var(--ok);
    font-weight: 500;
}
.notice-error { background: var(--danger-soft); color: var(--danger); }
.field-error {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 8px 0 0;
    color: var(--danger);
    font-size: 12px;
    line-height: 16px;
}
.field-error .msi { font-size: 16px; font-variation-settings: "FILL" 1, "wght" 400, "GRAD" 0, "opsz" 20; }

/* ---------- Toasts ---------- */
.toasts {
    position: fixed;
    left: 24px;
    bottom: 24px;
    z-index: 80;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}
.toast {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 288px;
    max-width: min(560px, calc(100vw - 48px));
    min-height: 48px;
    padding: 6px 8px 6px 16px;
    border-radius: 6px;
    background: var(--toast);
    color: var(--toast-ink);
    box-shadow: var(--shadow-2);
    font-size: 14px;
    pointer-events: auto;
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
}
.toast.is-shown { opacity: 1; transform: none; }
.toast-msg { flex: 1; padding: 8px 0; }
.toast-action {
    border: 0;
    background: transparent;
    color: var(--toast-link);
    font: 500 14px/20px var(--font-display);
    padding: 8px 12px;
    border-radius: 4px;
}
.toast-action:hover { background: rgba(255, 255, 255, 0.08); }
.toast-close {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--toast-ink);
}
.toast-close:hover { background: rgba(128, 128, 128, 0.2); }

/* ---------- Dialogs ---------- */
.dialog {
    border: 0;
    padding: 24px;
    border-radius: 28px;
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-3);
    max-width: calc(100vw - 32px);
}
.dialog::backdrop { background: var(--scrim); }
.dialog[open] { animation: dialog-in 0.18s var(--ease); }
@keyframes dialog-in { from { opacity: 0; transform: scale(0.96); } }
.dialog-head { display: flex; align-items: center; justify-content: space-between; margin: -8px -8px 12px 0; }
.dialog-head h2 { margin: 0; font: 400 22px/28px var(--font-display); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px; }
.confirm-dialog { width: 400px; }
.confirm-text { margin: 0; font-size: 15px; line-height: 22px; color: var(--text-2); }
.kbd-dialog { width: 720px; max-height: calc(100vh - 64px); }
.kbd-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 32px; }
.kbd-cols h3 { margin: 0 0 8px; font: 500 14px/20px var(--font-display); color: var(--accent); }
.kbd-list { margin: 0; }
.kbd-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 6px 0; border-bottom: 1px solid var(--row-line); }
.kbd-row dt { white-space: nowrap; order: 2; }
.kbd-row dd { margin: 0; color: var(--text-2); }
.kbd-or { color: var(--text-3); font-size: 12px; margin: 0 4px; }

/* ---------- Compose ---------- */
.compose-dock {
    position: fixed;
    right: 16px;
    bottom: 0;
    z-index: 60;
    display: flex;
    flex-direction: row-reverse;
    align-items: flex-end;
    gap: 16px;
    pointer-events: none;
}
.compose-backdrop {
    position: fixed;
    inset: 0;
    background: var(--scrim);
    pointer-events: auto;
    animation: fade-in 0.2s;
}
@keyframes fade-in { from { opacity: 0; } }
.compose {
    position: relative;
    width: 540px;
    height: min(600px, calc(100vh - 80px));
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border-radius: 16px 16px 0 0;
    box-shadow: var(--shadow-3);
    pointer-events: auto;
    overflow: hidden;
    transform-origin: bottom right;
    animation: compose-in 0.22s var(--ease);
    transition: height 0.2s var(--ease), width 0.2s var(--ease), opacity 0.2s, transform 0.2s var(--ease);
}
@keyframes compose-in { from { opacity: 0; transform: translateY(24px) scale(0.98); } }
.compose.is-closing { opacity: 0; transform: translateY(24px); pointer-events: none; }
.compose.is-sending { opacity: 0.55; pointer-events: none; }
.compose.is-min { height: 40px; width: 280px; }
.compose.is-min .compose-main { display: none; }
.compose.is-max {
    position: fixed;
    left: 50%;
    top: 50%;
    width: min(1120px, calc(100vw - 160px));
    height: calc(100vh - 96px);
    transform: translate(-50%, -50%);
    border-radius: 16px;
    animation: none;
    transform-origin: center;
}
.compose-head {
    display: flex;
    align-items: center;
    height: 40px;
    flex-shrink: 0;
    padding: 0 6px 0 16px;
    background: var(--compose-head);
    color: var(--text);
    font: 500 14px/20px var(--font-display);
    cursor: default;
}
.compose.is-min .compose-head { cursor: pointer; }
.compose-title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.compose-head .icon-btn { width: 28px; height: 28px; border-radius: 6px; color: var(--text-2); }
.compose-head .icon-btn .msi { font-size: 18px; }
.compose-main { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.compose-loading { padding: 16px; color: var(--text-3); }

.cf {
    position: relative;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    min-height: 40px;
    margin: 0 16px;
    padding: 4px 0;
    border-bottom: 1px solid var(--line);
}
.cf-label { color: var(--text-3); margin-right: 6px; font-size: 14px; }
.cf-toggles { margin-left: auto; display: flex; gap: 0; }
.cf-toggle {
    border: 0;
    background: none;
    color: var(--text-2);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 14px;
}
.cf-toggle:hover { text-decoration: underline; background: none; }
.cf-input {
    flex: 1 1 120px;
    min-width: 80px;
    height: 28px;
    border: 0;
    background: transparent;
    font-size: 14px;
    padding: 0 2px;
}
.cf-input:focus-visible { outline: none; }
.cf-subject { flex: 1 1 100%; }
.chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    max-width: 100%;
    height: 26px;
    padding: 0 2px 0 4px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: var(--surface);
    font-size: 14px;
}
.chip-av {
    display: inline-grid;
    place-items: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    color: #fff;
    font: 500 11px/1 var(--font-display);
}
.chip-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.chip-x {
    display: inline-grid;
    place-items: center;
    width: 20px;
    height: 20px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--text-3);
}
.chip-x .msi { font-size: 16px; }
.chip-x:hover { background: var(--hover); color: var(--text); }
.chip.is-bad { border-color: var(--danger); background: var(--danger-soft); color: var(--danger); }

.ac {
    position: absolute;
    left: 0;
    top: 100%;
    z-index: 5;
    min-width: 320px;
    max-width: 100%;
    margin: 2px 0 0;
    padding: 8px 0;
    list-style: none;
    background: var(--menu);
    border-radius: 8px;
    box-shadow: var(--shadow-2);
}
.ac-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 16px;
    cursor: pointer;
}
.ac-item.is-active, .ac-item:hover { background: var(--hover); }
.ac-item .avatar { width: 32px; height: 32px; font-size: 14px; }
.ac-text { display: flex; flex-direction: column; min-width: 0; }
.ac-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ac-email { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.editor {
    flex: 1;
    min-height: 120px;
    overflow-y: auto;
    padding: 12px 16px;
    font: 400 14px/1.5 Arial, Helvetica, sans-serif;
    color: var(--text);
    word-wrap: break-word;
    outline: none;
}
.editor:empty::before { content: attr(data-placeholder); color: var(--muted); }
.editor blockquote, .editor .gmail_quote blockquote {
    margin: 0 0 0 0.8ex;
    padding-left: 1ex;
    border-left: 1px solid #ccc;
}
.editor .gmail_quote { color: var(--text-2); }
.editor .neo-signature:not(.neo-sig-html) { color: var(--text-3); }
.editor img { max-width: 100%; height: auto; }
.editor a { color: var(--accent); }

.compose-atts { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 8px; }
.att-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    height: 32px;
    padding: 0 4px 0 10px;
    border-radius: 8px;
    background: var(--surface-alt);
    border: 1px solid var(--line);
    font-size: 13px;
}
.att-chip .msi { font-size: 18px; color: var(--text-3); }
.att-chip-name { color: var(--accent); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px; }
.att-chip-size { color: var(--text-3); white-space: nowrap; }

.format-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 2px;
    margin: 0 16px 4px;
    padding: 2px 4px;
    border-radius: 20px;
    background: var(--compose-head);
}
.format-bar .icon-btn { width: 32px; height: 32px; border-radius: 6px; }
.format-bar .icon-btn .msi { font-size: 20px; }
.format-bar .icon-btn.is-active { background: var(--accent-soft); color: var(--text); }
.format-bar .tb-sep { margin: 0 4px; height: 18px; }

.compose-foot {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px 12px 16px;
    flex-shrink: 0;
}
.send-btn {
    display: inline-flex;
    align-items: center;
    height: 36px;
    padding: 0 24px;
    border: 0;
    border-radius: 18px;
    background: var(--accent);
    color: var(--accent-ink);
    font: 500 14px/20px var(--font-display);
    letter-spacing: 0.25px;
    margin-right: 8px;
    transition: box-shadow 0.15s, background-color 0.15s;
}
.send-btn:hover { box-shadow: var(--shadow-1); background: var(--accent-hover); }
.send-btn:disabled { opacity: 0.6; }
.compose-status { margin-left: 8px; font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.compose-foot .spacer { flex: 1; }
.compose.is-dragover .compose-main { outline: 2px dashed var(--accent); outline-offset: -8px; background: color-mix(in srgb, var(--accent) 5%, var(--surface)); }

/* ---------- Plain pages (login, errors) ---------- */
body.plain {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
}
.plain-main {
    flex: 1;
    display: grid;
    place-items: center;
    padding: 24px 16px;
}
.plain-foot {
    width: 100%;
    max-width: 1040px;
    margin: 0 auto;
    padding: 8px 24px 24px;
    font-size: 12px;
    color: var(--text-3);
}

.auth-card {
    position: relative;
    width: 100%;
    max-width: 1040px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px 48px;
    padding: 36px 40px 32px;
    border-radius: 28px;
    background: var(--surface);
    overflow: hidden;
}
.auth-progress {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 4px;
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.2s;
}
.auth-progress span {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 40%;
    background: var(--accent);
    border-radius: 2px;
    animation: auth-progress 1.2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}
@keyframes auth-progress { from { left: -40%; } to { left: 100%; } }
.auth-card.is-busy .auth-progress { opacity: 1; }
.auth-card.is-busy .auth-form { opacity: 0.6; pointer-events: none; }
.auth-mark { width: 48px; height: 48px; display: block; margin-bottom: 20px; }
.auth-title { margin: 0 0 12px; font: 400 36px/44px var(--font-display); letter-spacing: -0.5px; color: var(--text); }
.auth-sub { margin: 0; font-size: 16px; line-height: 24px; color: var(--text); }
.auth-form { padding-top: 40px; transition: opacity 0.2s; }

.field { position: relative; margin-top: 8px; }
.field-input {
    width: 100%;
    height: 56px;
    padding: 0 15px;
    border: 1px solid var(--muted);
    border-radius: 4px;
    background: transparent;
    font-size: 16px;
    color: var(--text);
    transition: border-color 0.15s;
}
.field-input:hover { border-color: var(--text); }
.field-input:focus { outline: none; border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.field-label {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    padding: 0 4px;
    background: var(--surface);
    color: var(--text-2);
    font-size: 16px;
    pointer-events: none;
    transition: top 0.15s var(--ease), font-size 0.15s var(--ease), color 0.15s;
}
.field-input:focus + .field-label,
.field-input:not(:placeholder-shown) + .field-label { top: 0; font-size: 12px; }
.field-input:focus + .field-label { color: var(--accent); }
.field.is-invalid .field-input { border-color: var(--danger); box-shadow: inset 0 0 0 1px var(--danger); }
.field.is-invalid .field-label { color: var(--danger); }
.field-hint { margin: 8px 0 24px 2px; font-size: 12px; line-height: 16px; color: var(--text-3); }
.field-error + .field-hint { margin-top: 6px; }
.auth-form > .field-error { margin-bottom: 4px; }
.check { display: inline-flex; align-items: center; gap: 12px; margin-top: 16px; font-size: 14px; color: var(--text); cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 0 0 0 2px; accent-color: var(--accent); cursor: pointer; }
.auth-note { margin: 28px 0 0; font-size: 14px; line-height: 20px; color: var(--text-3); }
.auth-actions { display: flex; justify-content: flex-end; margin-top: 32px; }

.err-card {
    width: 100%;
    max-width: 520px;
    padding: 40px;
    border-radius: 28px;
    background: var(--surface);
}
.err-mark { display: block; margin-bottom: 24px; }
.err-code { margin: 0 0 4px; font: 500 14px/20px var(--font-display); color: var(--text-3); }
.err-title { margin: 0 0 12px; font: 400 28px/36px var(--font-display); color: var(--text); }
.err-text { margin: 0; font-size: 15px; line-height: 22px; color: var(--text-2); }
.err-actions { display: flex; gap: 8px; margin-top: 32px; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
    .cell-from { flex-basis: 160px; padding-right: 20px; }
}

@media (max-width: 767.98px) {
    :root { --topbar-h: 60px; }
    .topbar { padding: 6px 8px; gap: 4px; }
    .topbar-left { width: auto; padding-left: 0; }
    .brand-name { display: none; }
    .brand { padding: 0 4px; }
    .search { height: 44px; }
    .hide-sm { display: none !important; }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 70;
        width: 280px;
        padding-top: 8px;
        background: var(--bg);
        transform: translateX(-100%);
        transition: transform 0.25s var(--ease), visibility 0.25s;
        visibility: hidden;
        box-shadow: var(--shadow-3);
    }
    body.nav-open .sidebar { transform: none; visibility: visible; }
    .scrim {
        position: fixed;
        inset: 0;
        z-index: 65;
        background: var(--scrim);
        animation: fade-in 0.2s;
    }
    .fab { display: inline-flex; }
    .surface { margin: 0; border-radius: 16px 16px 0 0; }
    .toolbar { padding-right: 4px; }
    .pager-text { display: none; }

    .mrow {
        height: auto;
        min-height: 72px;
        align-items: flex-start;
        padding: 10px 12px 10px 4px;
    }
    .mrow .cb-cell { margin-top: 2px; }
    .mrow-link { flex-wrap: wrap; align-items: baseline; row-gap: 2px; padding-left: 4px; padding-right: 32px; }
    .cell-from { flex: 1 1 auto; order: 1; padding-right: 8px; font-size: 15px; }
    .cell-date { order: 2; min-width: 0; padding-left: 8px; }
    .cell-att { order: 3; padding-left: 4px; }
    .cell-main { order: 4; flex: 1 1 100%; white-space: normal; }
    .cell-main .subj, .cell-main .snip { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .cell-main .label-chip { float: left; margin-top: 1px; }
    .snip-sep { display: none; }
    /* List rows only: a conversation's per-message star stays in its header. */
    .mrow .star-btn { position: absolute; right: 6px; bottom: 6px; }
    /* Room under the last row for the floating Compose button. */
    .list-scroll { padding-bottom: 88px; }
    /* Gmail mobile hides the Compose button inside a conversation (reply buttons are there). */
    body[data-view="conversation"] .fab { display: none; }

    .conv-head { padding: 12px 16px; }
    .msg-head { grid-template-columns: 40px minmax(0, 1fr); padding: 12px 12px 6px; column-gap: 12px; }
    .msg-meta { grid-column: 2; justify-content: flex-start; flex-wrap: wrap; margin-left: -8px; }
    .msg-content { padding: 0 12px 16px; }
    .msg-details { margin: 0 12px 8px; max-width: calc(100% - 24px); }
    .conv-actions { padding: 12px 12px 96px; }
    .att-card { width: calc(50% - 6px); }

    .compose-dock { right: 0; left: 0; gap: 0; }
    .compose, .compose.is-max, .compose.is-min {
        position: fixed;
        inset: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
        transform: none;
    }
    .compose.is-min { inset: auto 0 0 0; height: 48px; }
    .compose-head { height: 48px; }
    .compose-max { display: none !important; }
    .format-bar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
    .format-bar .icon-btn { flex-shrink: 0; }

    .set-row { grid-template-columns: 1fr; gap: 8px; }
    .settings-form { padding: 8px 16px 40px; }

    .auth-card { grid-template-columns: 1fr; padding: 28px 24px 24px; gap: 0; border-radius: 0; background: transparent; }
    body.auth-page { background: var(--surface); }
    .auth-card .field-label { background: var(--surface); }
    .auth-form { padding-top: 24px; }
    .auth-title { font-size: 28px; line-height: 36px; }
    .kbd-cols { grid-template-columns: 1fr; }
    .toasts { left: 12px; right: 12px; bottom: 88px; }
    .toast { min-width: 0; max-width: none; }
    .err-card { padding: 28px 24px; }
}

/* Rows of an action in flight: faded and not clickable until the server answers. */
.mrow.is-pending { opacity: 0.45; pointer-events: none; transition: opacity 0.15s; }

/* "Undo send": the compose window waits, hidden, until the message really goes. */
.compose.is-held { display: none !important; }

/* Gmail's Select dropdown next to the select-all checkbox. */
.select-menu-wrap { margin-left: -10px; }
.icon-btn-narrow { width: 20px; border-radius: 4px; }

/* Trash / Spam: "Empty Trash now". */
.purge-banner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 4px 12px;
    padding: 10px 16px;
    margin: 0 0 4px;
    background: var(--surface-alt);
    color: var(--text-2);
    font-size: 13px;
    text-align: center;
}
.purge-banner .link-btn { font-weight: 500; }

/* Page-load progress (folder loads sync with IMAP first and can take a moment). */
body.is-loading::before {
    content: '';
    position: fixed;
    top: 0;
    left: -40%;
    z-index: 200;
    width: 40%;
    height: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--accent);
    animation: auth-progress 1.1s var(--ease) infinite;
    pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

@media print {
    .topbar, .sidebar, .toolbar, .compose-dock, .toasts, .conv-actions { display: none !important; }
    body.app { height: auto; overflow: visible; }
    .surface { margin: 0; border-radius: 0; }
}

/* Settings: checkbox row */
.set-check { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; padding: 6px 0; }
.set-check input { width: 18px; height: 18px; accent-color: var(--accent, #0b57d0); margin: 0; }

/* Settings: designed signature */
.code-input { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12.5px; line-height: 1.5; }
.sig-preview-label { margin: 14px 0 6px; font-size: 12px; font-weight: 500; color: var(--text-2); text-transform: uppercase; letter-spacing: .06em; }
.sig-preview { padding: 18px 20px; background: #fff; color: #1f2937; border: 1px solid var(--border, #dadce0); border-radius: 12px; overflow-x: auto; }
