/* ASU Trading Mailbox — three-pane design */
:root {
    --bg: #f4f5f7;
    --panel: #ffffff;
    --soft: #f6f7f9;
    --soft-2: #eff1f4;
    --line: #eceef2;
    --line-2: #e2e5ea;
    --text: #1d2433;
    --text-2: #3d4655;
    --muted: #7a8495;
    --blue: #2f7cf6;
    --blue-2: #1f6be6;
    --blue-soft: #eaf2ff;
    --purple: #7c3aed;
    --purple-soft: #f4effe;
    --green: #16a34a;
    --red: #dc2626;
    --gold: #c9a227;
    --navy: #0f2a4a;
    --radius: 14px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
    color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
    font: 14px/1.5 Inter, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2 { margin: 0; line-height: 1.25; font-weight: 600; }
hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
[hidden] { display: none !important; }
.icon { width: 18px; height: 18px; flex: none; vertical-align: middle; }
kbd { font: 600 11px Inter, sans-serif; padding: 3px 6px; border-radius: 6px; background: #fff; border: 1px solid var(--line-2); color: var(--text-2); }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 40px; padding: 0 16px;
    border: 1px solid transparent; border-radius: 10px;
    font: inherit; font-weight: 500; cursor: pointer;
    background: var(--panel); color: var(--text);
    text-decoration: none !important; white-space: nowrap;
    transition: background .15s, border-color .15s, box-shadow .15s;
}
.btn-primary { background: linear-gradient(135deg, #3b8bff, var(--blue-2)); color: #fff; box-shadow: 0 4px 12px rgba(47,124,246,.3); }
.btn-primary:hover { background: var(--blue-2); }
.btn-ghost { border-color: var(--line-2); }
.btn-ghost:hover { background: var(--soft); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-block { width: 100%; }
.btn.danger, .link-btn.danger { color: var(--red); }
.btn[disabled] { opacity: .65; cursor: progress; }
.icon-btn {
    display: inline-grid; place-items: center; flex: none;
    width: 36px; height: 36px; border-radius: 10px;
    border: 0; background: transparent; color: #4b5565; cursor: pointer; list-style: none;
}
.icon-btn::-webkit-details-marker { display: none; }
.icon-btn:hover { background: var(--soft-2); color: var(--text); text-decoration: none; }
.icon-btn.sm { width: 30px; height: 30px; border-radius: 8px; }
.icon-btn.sm .icon { width: 16px; height: 16px; }
.link-btn { border: 0; background: none; padding: 0; font: inherit; color: var(--blue); cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.vsep { width: 1px; height: 18px; background: var(--line-2); margin: 0 4px; flex: none; }

/* ---------- Avatars ---------- */
.avatar {
    --hue: 210;
    display: inline-grid; place-items: center; flex: none;
    border-radius: 50%; object-fit: cover;
    background: hsl(var(--hue) 55% 92%); color: hsl(var(--hue) 45% 32%);
    font-weight: 600; user-select: none;
}
.avatar-xs { width: 22px; height: 22px; font-size: 10px; }
.avatar-sm { width: 32px; height: 32px; font-size: 12px; }
.avatar-md { width: 36px; height: 36px; font-size: 13px; }
.avatar-lg { width: 46px; height: 46px; font-size: 16px; border-radius: 12px; }
.avatar-card { width: 52px; height: 52px; font-size: 17px; border-radius: 12px; }
.avatar-rail { width: 44px; height: 44px; font-size: 15px; border-radius: 12px; }
.avatar-xl2 { width: 56px; height: 56px; font-size: 19px; }
.avatar-xl { width: 128px; height: 128px; font-size: 44px; }

/* ---------- Frame ---------- */
.frame { display: flex; height: 100vh; overflow: hidden; }

/* Account rail */
.rail {
    width: 76px; flex: none; padding: 16px 0;
    display: flex; flex-direction: column; align-items: center; gap: 12px;
    background: var(--panel); border-right: 1px solid var(--line);
    overflow-y: auto;
}
.rail-logo img { display: block; border-radius: 12px; }
.rail-line { width: 28px; height: 1px; background: var(--line-2); }
.rail-count {
    width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
    background: var(--soft-2); color: var(--text); font-weight: 600; position: relative;
}
.rail-count::before { content: ""; position: absolute; top: 6px; width: 14px; height: 2px; border-radius: 2px; background: var(--muted); opacity: .5; }
.rail-count:hover { text-decoration: none; background: var(--line-2); }
.rail-form { margin: 0; }
.rail-acct { background: none; cursor: pointer; font: inherit; display: block; }
.rail-acct { position: relative; border-radius: 14px; padding: 3px; border: 2px solid transparent; transition: border-color .15s; }
.rail-acct:hover { border-color: var(--line-2); }
.rail-acct.active { border-color: var(--blue); }
.rail-acct .avatar { display: grid; }
.rail-badge {
    position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px;
    border-radius: 9px; background: var(--red); color: #fff; font-size: 10.5px; font-weight: 700;
    display: grid; place-items: center; border: 2px solid #fff;
}
.rail-add {
    width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
    background: var(--soft-2); color: var(--text-2);
}
.rail-add:hover { background: var(--line-2); }

/* Sidebar */
.sidebar {
    width: 286px; flex: none; padding: 20px 18px;
    background: var(--panel); border-right: 1px solid var(--line);
    overflow-y: auto; display: flex; flex-direction: column;
}
.profile-card {
    display: flex; align-items: center; gap: 12px;
    padding: 10px; border: 1px solid var(--line-2); border-radius: var(--radius);
    position: relative;
}
.profile-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.profile-text strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-text span { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropdown { position: relative; }
.dropdown > summary { list-style: none; }
.dropdown .menu {
    position: absolute; right: 0; top: calc(100% + 6px); z-index: 40;
    min-width: 240px; padding: 6px; background: var(--panel);
    border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(16,24,40,.14);
}
.menu a, .menu button {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 9px 10px; border: 0; border-radius: 8px;
    background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.menu a:hover, .menu button:hover { background: var(--soft); text-decoration: none; }
.menu form { margin: 0; }
.menu-move { display: flex; gap: 6px; padding: 6px 4px 4px; border-top: 1px solid var(--line); margin-top: 4px; }
.menu-move select { flex: 1; max-width: none; }
.menu-move .btn { width: auto; display: inline-flex; padding: 0 12px; }

.side-search {
    display: flex; align-items: center; gap: 10px; margin-top: 16px;
    height: 46px; padding: 0 8px 0 14px; border-radius: 12px; background: var(--soft);
    color: var(--muted);
}
.side-search:focus-within { box-shadow: 0 0 0 2px var(--blue-soft), inset 0 0 0 1px var(--blue); }
.side-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: inherit; color: var(--text); }
.compose-btn {
    margin-top: 16px; height: 48px; border-radius: 12px;
    display: flex; align-items: center; gap: 12px; padding: 0 18px;
    color: #fff; font-weight: 500; font-size: 15px;
    background:
        repeating-linear-gradient(135deg, rgba(255,255,255,0) 0 22px, rgba(255,255,255,.12) 22px 23px),
        linear-gradient(135deg, #4b97ff, var(--blue-2));
    box-shadow: 0 6px 16px rgba(47,124,246,.35);
}
.compose-btn:hover { text-decoration: none; filter: brightness(1.05); }
.nav-label { margin: 18px 0 8px; color: var(--muted); font-size: 13px; }
.nav-label.row { display: flex; align-items: center; justify-content: space-between; }
.nav-label form { margin: 0; }
.nav { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.nav a {
    display: flex; align-items: center; gap: 14px;
    height: 44px; padding: 0 12px 0 calc(14px + var(--depth, 0) * 14px);
    border-radius: 10px; color: var(--text-2); font-size: 15px;
}
.nav a:hover { background: var(--soft); text-decoration: none; }
.nav a.active { background: var(--soft-2); color: var(--text); font-weight: 500; }
.nav .icon { width: 20px; height: 20px; stroke-width: 1.7; }
.nav .chev { width: 14px; height: 14px; margin-right: -6px; color: var(--muted); }
.nav .label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav .count { min-width: 24px; padding: 0 7px; border-radius: 12px; background: var(--blue); color: #fff; font-size: 12px; font-weight: 600; text-align: center; line-height: 22px; }
.nav-empty { padding: 6px 14px; color: var(--muted); font-size: 13px; }
.scrim { display: none; }

/* Workspace */
.workspace { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; overflow: hidden; }
.menu-toggle { display: none; }
.flashes { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); z-index: 50; display: flex; flex-direction: column; gap: 8px; width: min(520px, calc(100% - 32px)); }
.flash {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 8px 10px 16px; border-radius: 12px;
    background: #1d2433; color: #fff; font-weight: 500; box-shadow: 0 12px 30px rgba(16,24,40,.25);
}
.flash .icon-btn { margin-left: auto; color: inherit; }
.flash .icon-btn:hover { background: rgba(255,255,255,.12); }
.flash-error { background: #fdecec; color: #a61b1b; box-shadow: none; }
.flash-success::before { content: "✓"; color: #4ade80; font-weight: 700; }
.pane > .flash, .composer > .flash, .settings > .flash { margin: 12px 20px; position: static; }

/* ---------- Split: list + reader ---------- */
.split { flex: 1; display: grid; grid-template-columns: minmax(380px, 46%) 1fr; min-height: 0; }
.list-pane { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); background: var(--panel); }
.list-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 22px 26px 18px; border-bottom: 1px solid var(--line); }
.greet { display: flex; align-items: center; gap: 14px; min-width: 0; }
.greet h1 { font-size: 26px; font-weight: 600; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.greet .divider { width: 1px; height: 22px; background: var(--line-2); flex: none; }
.greet .total { color: var(--muted); font-size: 18px; white-space: nowrap; }
.tabs-row { display: flex; align-items: center; gap: 8px; margin: 18px 26px 10px; padding: 6px; border-radius: 14px; background: var(--soft-2); }
.tabs { flex: 1; display: flex; gap: 4px; }
.tabs a {
    flex: 1; text-align: center; padding: 9px 10px; border-radius: 10px;
    color: var(--muted); font-size: 15px; white-space: nowrap;
}
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { background: var(--panel); color: var(--text); font-weight: 500; box-shadow: var(--shadow); }
.tab-add { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--panel); color: var(--text); box-shadow: var(--shadow); }
.search-note { margin: 0 26px 6px; color: var(--muted); }

.list-form { flex: 1; overflow-y: auto; min-height: 0; }
.bulk-bar {
    position: sticky; top: 0; z-index: 5; display: none; align-items: center; gap: 2px; flex-wrap: wrap;
    padding: 8px 20px; background: var(--blue-soft); border-bottom: 1px solid var(--line);
}
.has-selection .bulk-bar { display: flex; }
.bulk-count { font-weight: 600; margin-right: 8px; }
.bulk-bar select { margin-left: 6px; }
select {
    height: 32px; padding: 0 8px; border: 1px solid var(--line-2); border-radius: 8px;
    font: inherit; font-size: 13px; background: var(--panel); color: var(--text); max-width: 170px;
}

.cards { list-style: none; margin: 0; padding: 0; }
.card {
    display: grid; grid-template-columns: 52px 1fr; column-gap: 16px;
    padding: 22px 26px; border-bottom: 1px solid var(--line); background: var(--panel);
    position: relative; transition: background .12s;
}
.card:hover { background: #fbfbfc; }
.card.active { background: var(--soft); }
.card.active::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 0 3px 3px 0; background: var(--blue); }
.card.selected { background: var(--blue-soft); }
.card-pick { position: relative; width: 52px; height: 52px; cursor: pointer; grid-row: span 2; }
.card-pick .check { position: absolute; inset: 0; width: 52px; height: 52px; border-radius: 12px; background: rgba(255,255,255,.9); opacity: 0; transition: opacity .12s; }
.card:hover .card-pick .check, .has-selection .card-pick .check { opacity: 1; }
.card-link { display: flex; flex-direction: column; gap: 4px; min-width: 0; color: inherit; text-decoration: none !important; }
.card-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.card-name { font-size: 15px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); flex: none; box-shadow: 0 0 0 3px #dcfce7; }
.list-actions { display: flex; align-items: center; gap: 4px; flex: none; }
.star-btn {
    position: absolute; right: 18px; top: 54px; width: 32px; height: 32px; border-radius: 8px;
    border: 0; background: none; color: #b6bdc9; cursor: pointer; display: grid; place-items: center;
    opacity: 0; transition: opacity .12s;
}
.card:hover .star-btn, .star-btn.on, .star-btn:focus-visible { opacity: 1; }
.star-btn:hover { background: var(--soft-2); color: var(--gold); }
.star-btn.on { color: var(--gold); }
.star-btn.on .icon { fill: var(--gold); }
.card-subject { padding-right: 30px; }
.card-top time { margin-left: auto; color: var(--muted); font-size: 13.5px; white-space: nowrap; flex: none; }
.card-subject { font-size: 17px; font-weight: 500; color: var(--text); display: flex; align-items: center; gap: 6px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 4px; }
.card.unread .card-subject { font-weight: 600; }
.card.unread .card-name { font-weight: 600; }
.replied .icon { width: 14px; height: 14px; color: var(--muted); }
.imp { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--purple-soft); color: var(--purple); font-size: 12px; font-weight: 700; flex: none; }
.card-preview { color: var(--muted); font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 8px; }
.card-files { grid-column: 2; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.file-chip {
    display: inline-flex; align-items: center; gap: 8px; max-width: 240px;
    padding: 7px 12px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--soft);
    color: var(--text); font-size: 14px;
}
.file-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-chip:hover { border-color: var(--blue); text-decoration: none; background: var(--blue-soft); }
.file-chip .icon { width: 18px; height: 18px; color: var(--text-2); }
.file-more { align-self: center; color: var(--muted); font-size: 13px; }
.pager { display: flex; align-items: center; justify-content: flex-end; gap: 4px; padding: 12px 20px; color: var(--muted); font-size: 13px; }
.pager span { margin-right: 8px; }

.check { position: relative; display: inline-grid; place-items: center; width: 36px; height: 36px; cursor: pointer; flex: none; }
.check input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.check span { width: 18px; height: 18px; border: 2px solid #9aa3b2; border-radius: 5px; background: #fff; transition: .12s; }
.check input:checked + span { background: var(--blue); border-color: var(--blue); box-shadow: inset 0 0 0 2px #fff; }
.check input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 2px; }

.empty { padding: 72px 20px; text-align: center; color: var(--muted); }
.empty .icon { width: 44px; height: 44px; stroke-width: 1.4; color: #b6bdc9; }
.empty h1 { font-size: 20px; margin: 12px 0 4px; color: var(--text); }

/* ---------- Reader ---------- */
.reader-pane { min-width: 0; min-height: 0; overflow: hidden; display: flex; flex-direction: column; background: var(--bg); padding: 22px; transition: opacity .15s; }
.reader-pane.loading { opacity: .55; }
.reader-empty { margin: auto; text-align: center; color: var(--muted); max-width: 320px; }
.reader-empty .icon { width: 52px; height: 52px; stroke-width: 1.3; color: #b6bdc9; }
.reader-empty h2 { font-size: 18px; color: var(--text); margin: 14px 0 6px; }
.reader { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--panel); border-radius: 18px; box-shadow: var(--shadow); overflow: hidden; }
.reader-tools { display: flex; align-items: center; gap: 4px; padding: 14px 20px; border-bottom: 1px solid var(--line); flex: none; }
.reader-tools .dropdown .menu { left: 0; right: auto; }
.reader-scroll { flex: 1; overflow-y: auto; padding: 24px 32px 28px; }
.reader-subject { font-size: 24px; font-weight: 600; letter-spacing: -.01em; overflow-wrap: anywhere; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.reader-from { display: flex; align-items: flex-start; gap: 14px; padding: 20px 0; border-bottom: 1px solid var(--line); }
.from-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.from-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 16px; }
.from-line strong { font-weight: 500; }
.verified { color: #1d9bf0; display: inline-grid; flex: none; margin-left: 2px; }
.verified .icon { width: 20px; height: 20px; }
.from-line strong .verified { display: inline-block; vertical-align: -4px; margin-left: 5px; }
.card-top .verified { margin-left: -2px; }
.card-top .verified .icon { width: 17px; height: 17px; }
.profile-text strong { display: flex; align-items: center; gap: 3px; min-width: 0; }
.profile-text strong > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-text .verified { color: #1d9bf0; }
.profile-text .verified .icon { width: 16px; height: 16px; }
.to-line { display: flex; flex-wrap: wrap; gap: 4px 20px; color: var(--text); font-size: 14.5px; }
.reader-from time { font-size: 12.5px; white-space: nowrap; }
.important {
    display: flex; align-items: center; gap: 12px; margin: 20px 0 4px;
    padding: 14px 18px; border-radius: 12px; background: var(--purple-soft); border: 1px solid #e5d8fd;
    color: var(--purple); font-size: 16px; font-weight: 500;
}
.important .icon { width: 22px; height: 22px; }
.mail-body { display: block; width: 100%; margin: 20px 0 8px; min-height: 120px; border: 0; }
.att-images, .att-files { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.att-images h2, .att-files h2 { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-bottom: 12px; }
.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.img-grid figure { margin: 0; border: 1px solid var(--line-2); border-radius: 12px; overflow: hidden; background: var(--soft); }
.img-grid img { display: block; width: 100%; height: 140px; object-fit: cover; background: var(--soft-2); }
.img-grid figcaption { display: flex; align-items: center; gap: 6px; padding: 4px 4px 4px 10px; font-size: 12.5px; }
.img-grid figcaption span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-files ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.att-file { display: flex; align-items: center; gap: 2px; border: 1px solid var(--line-2); border-radius: 12px; padding-right: 6px; background: var(--panel); }
.att-file:hover { border-color: #c9d6ea; }
.att-open { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 10px 12px; color: var(--text); }
.att-open:hover { text-decoration: none; }
.att-ext { width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center; background: var(--navy); color: #fff; font-size: 11px; font-weight: 700; flex: none; }
.att-ext.pdf { background: #e5484d; }
.att-meta { min-width: 0; display: flex; flex-direction: column; }
.att-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reply-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 24px; }

/* ---------- Pages inside the workspace (compose, settings, errors) ---------- */
.pane { margin: 22px; background: var(--panel); border-radius: 18px; box-shadow: var(--shadow); overflow: auto; flex: 1; min-height: 0; }
.list-head { padding: 22px 24px 10px; }
.list-head h1 { display: flex; align-items: center; gap: 10px; font-size: 22px; }
.list-head p { margin: 6px 0 0; }

/* Composer */
.composer { display: flex; flex-direction: column; }
.composer-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 14px 24px; border-bottom: 1px solid var(--line); }
.composer-head h1 { font-size: 18px; }
.suggest {
    position: absolute; left: 86px; top: calc(100% - 4px); z-index: 30; width: min(440px, calc(100% - 100px));
    margin: 0; padding: 6px; list-style: none; background: var(--panel);
    border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(16,24,40,.14);
}
.suggest li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.suggest li.on, .suggest li:hover { background: var(--blue-soft); }
.sg-av { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--soft-2); color: var(--text-2); font-size: 12px; font-weight: 600; flex: none; }
.sg-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.sg-text strong { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sg-text span { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sg-tag { font-size: 11px; padding: 2px 8px; border-radius: 10px; background: var(--blue-soft); color: var(--blue); flex: none; }
.addr-row { position: relative; }
.addr-row { display: flex; align-items: center; gap: 10px; min-height: 50px; padding: 0 24px; border-bottom: 1px solid var(--line); }
.addr-label { width: 62px; flex: none; color: var(--muted); }
.addr-row input { flex: 1; min-width: 0; height: 48px; border: 0; outline: 0; font: inherit; font-size: 15px; background: transparent; color: var(--text); }
.from-chip { display: inline-flex; align-items: center; gap: 8px; padding: 3px 12px 3px 3px; border-radius: 16px; background: var(--soft-2); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.editor-toolbar { display: flex; align-items: center; gap: 2px; padding: 6px 18px; border-bottom: 1px solid var(--line); }
.editor-toolbar button, .tool-btn {
    min-width: 34px; height: 34px; padding: 0 6px; border: 0; border-radius: 8px;
    background: none; font: inherit; font-size: 14px; color: var(--text-2); cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
}
.editor-toolbar button:hover, .tool-btn:hover { background: var(--soft-2); }
.editor-toolbar .sep { width: 1px; height: 20px; background: var(--line-2); margin: 0 6px; }
.editor-wrap { position: relative; flex: 1; display: flex; flex-direction: column; }
.editor { flex: 1; min-height: 320px; padding: 18px 24px; outline: 0; font-size: 15px; line-height: 1.6; overflow-wrap: anywhere; }
.editor blockquote { margin: 0 0 0 .8ex; padding-left: 1ex; border-left: 2px solid #ccc; color: #5b6577; }
.editor img { max-width: 100%; height: auto; border-radius: 4px; }
.drop-hint {
    position: absolute; inset: 10px; border: 2px dashed var(--blue); border-radius: 14px;
    background: rgba(234,242,255,.92); color: var(--blue); font-size: 16px; font-weight: 600;
    display: none; align-items: center; justify-content: center; gap: 10px; pointer-events: none;
}
.drop-hint .icon { width: 26px; height: 26px; }
.dragging .drop-hint { display: flex; }
.asu-signature { color: #52606d; }
.composer-files { padding: 0 24px; }
.file-chips { list-style: none; margin: 8px 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.file-chips li {
    display: inline-flex; align-items: center; gap: 8px; padding: 5px 6px 5px 6px; border-radius: 10px;
    background: var(--soft); border: 1px solid var(--line-2); font-size: 13px; max-width: 100%;
}
.file-chips li > label { padding-left: 4px; }
.file-chips label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.file-chips .icon { width: 14px; height: 14px; }
.file-chips .thumb { width: 34px; height: 34px; border-radius: 6px; object-fit: cover; background: var(--soft-2); }
.file-chips .ftype { width: 34px; height: 34px; border-radius: 6px; display: grid; place-items: center; background: var(--navy); color: #fff; font-size: 9.5px; font-weight: 700; }
.file-chips .ftype.pdf { background: #e5484d; }
.file-chips .fname { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-chips .remove { border: 0; background: none; cursor: pointer; color: var(--muted); width: 24px; height: 24px; border-radius: 6px; display: grid; place-items: center; }
.file-chips .remove:hover { background: var(--line-2); color: var(--text); }
.files-total { margin: 0 0 8px; }
.composer-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 14px 24px 20px; border-top: 1px solid var(--line); margin-top: auto; }
.push-right { margin-left: auto; }

/* Settings */
.settings-grid { display: grid; grid-template-columns: 300px 1fr; gap: 20px; padding: 8px 24px 24px; }
.box { border: 1px solid var(--line-2); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.box h2 { font-size: 15px; }
.box.wide, .settings-actions { grid-column: 1 / -1; }
.photo-card { align-items: center; text-align: center; }
.photo-preview .avatar { box-shadow: 0 0 0 4px #fff, 0 0 0 6px var(--blue); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-weight: 500; font-size: 13px; }
.field input, .field textarea {
    width: 100%; padding: 11px 13px; border: 1px solid var(--line-2); border-radius: 10px;
    font: inherit; color: var(--text); background: #fff;
}
.field textarea { resize: vertical; min-height: 120px; }
.field input:focus, .field textarea:focus { outline: 0; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
.field input:disabled { background: var(--soft); color: var(--muted); }
.toggle { display: flex; align-items: center; gap: 10px; cursor: pointer; text-align: left; }
.toggle input { width: 18px; height: 18px; accent-color: var(--blue); flex: none; }
.settings-actions { display: flex; justify-content: flex-end; }
.sig-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.sig-preview { display: flex; flex-direction: column; gap: 8px; }
.sig-preview-label { font-weight: 500; font-size: 13px; }
.sig-preview-mail { padding: 16px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--soft); overflow-x: auto; }
.sig-preview-mail p { margin: 0 0 14px; }
.gmail-card p, .gmail-card ol { margin: 0; }
.gmail-card ol { padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
.gmail-card h2 { display: flex; align-items: center; gap: 8px; }

/* ---------- Login ---------- */
.login-page { min-height: 100vh; background: radial-gradient(1000px 500px at 15% -10%, #dbe8ff, transparent 60%), radial-gradient(800px 500px at 110% 110%, #efe6ff, transparent 60%), var(--bg); }
.login-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 410px; padding: 34px 30px; border-radius: 20px; background: var(--panel); box-shadow: 0 20px 60px rgba(16,24,40,.12); }
.login-brand { text-align: center; margin-bottom: 24px; }
.login-brand img { border-radius: 14px; }
.login-brand h1 { font-size: 22px; margin-top: 14px; }
.login-brand p { margin: 4px 0 0; color: var(--muted); }
.login-card .flash { position: static; margin-bottom: 14px; box-shadow: none; background: var(--blue-soft); color: #1e4fa8; }
.login-card .flash-error { background: #fdecec; color: #a61b1b; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack .btn { height: 46px; }
.login-foot { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 20px 0 0; color: var(--muted); font-size: 12.5px; }
.login-foot .icon { width: 14px; height: 14px; }
.login-copy { color: var(--muted); font-size: 12.5px; margin-top: 20px; }

/* ---------- Installer ---------- */
.install-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; padding: 40px 16px; }
.install-card { width: 100%; max-width: 720px; padding: 34px 32px; border-radius: 20px; background: var(--panel); box-shadow: 0 20px 60px rgba(16,24,40,.12); }
.install-card .flash { position: static; margin-bottom: 14px; box-shadow: none; background: var(--blue-soft); color: #1e4fa8; }
.install-card .flash-error { background: #fdecec; color: #a61b1b; }
.install-card .flash-success { background: #e7f6ee; color: #146c43; }
.install-card .flash-success::before { color: #16a34a; }
.install-h { font-size: 16px; margin: 26px 0 10px; padding-top: 18px; border-top: 1px solid var(--line); }
.install-h:first-of-type { border-top: 0; padding-top: 0; }
.install-checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.install-checks li { display: flex; gap: 10px; align-items: flex-start; padding: 8px 12px; border-radius: 10px; background: var(--soft); }
.install-checks li small { display: block; color: var(--muted); margin-top: 2px; }
.install-checks .mark { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #fff; flex: none; }
.install-checks .ok .mark { background: var(--green); }
.install-checks .bad { background: #fdecec; }
.install-checks .bad .mark { background: var(--red); }
.install-checks .warn { background: #fff7e6; }
.install-checks .warn .mark { background: #d97706; }
.install-form { display: flex; flex-direction: column; gap: 14px; }
.install-form .install-h { margin-bottom: 0; }
.install-form p { margin: 0; }
.install-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.install-pair { display: flex; gap: 8px; }
.install-pair input { width: 90px; flex: none; }
.install-pair select { flex: 1; max-width: none; height: auto; padding: 11px 10px; border-radius: 10px; font-size: 14px; }
.install-form select { height: auto; padding: 11px 10px; border-radius: 10px; font-size: 14px; max-width: none; }
.install-more summary { cursor: pointer; color: var(--blue); }
.install-more .install-row { margin-top: 12px; }
.install-go { height: 48px; margin-top: 10px; font-size: 15px; }
.install-notes { margin: 0 0 16px; padding-left: 20px; }
.install-steps { padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.install-code { width: 100%; font: 12px/1.5 ui-monospace, Consolas, monospace; padding: 12px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--soft); margin: 10px 0 16px; }
code { font: 12.5px ui-monospace, Consolas, monospace; background: var(--soft-2); padding: 1px 5px; border-radius: 5px; }
@media (max-width: 600px) { .install-row { grid-template-columns: 1fr; } .install-card { padding: 26px 18px; } }

/* ---------- Print: just the open message ---------- */
@media print {
    body, .frame, .workspace, .split, .reader-pane, .reader, .reader-scroll { display: block !important; height: auto !important; overflow: visible !important; background: #fff !important; box-shadow: none !important; padding: 0 !important; }
    .rail, .sidebar, .scrim, .list-pane, .reader-tools, .reply-bar, .menu-toggle, .flashes, .icon-btn { display: none !important; }
    .reader-pane { padding: 0 !important; }
    .img-grid img { height: auto; max-height: 300px; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1280px) {
    .sidebar { width: 250px; }
    .split { grid-template-columns: minmax(340px, 44%) 1fr; }
    .greet h1 { font-size: 22px; }
    .greet .total { font-size: 15px; }
}
@media (max-width: 1060px) {
    .split { grid-template-columns: 1fr; }
    .reader-pane { display: none; }
    .has-reader .list-pane { display: none; }
    .has-reader .reader-pane { display: flex; padding: 12px; }
    .settings-grid, .sig-layout { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
    .rail, .sidebar {
        position: fixed; top: 0; bottom: 0; z-index: 30; transition: transform .2s ease;
    }
    .rail { left: 0; transform: translateX(-110%); }
    .sidebar { left: 76px; transform: translateX(calc(-100% - 80px)); box-shadow: 8px 0 24px rgba(16,24,40,.12); }
    .sidebar-open .rail, .sidebar-open .sidebar { transform: none; }
    .sidebar-open .scrim { display: block; position: fixed; inset: 0; z-index: 25; background: rgba(16,24,40,.35); }
    .menu-toggle { display: inline-grid; position: absolute; top: 18px; left: 12px; z-index: 6; background: var(--panel); box-shadow: var(--shadow); }
    .list-top { padding-left: 60px; }
    .has-reader .menu-toggle { display: none; }
    .pane { margin: 60px 8px 8px; }
}
@media (max-width: 560px) {
    .list-top { padding: 18px 14px 14px 58px; }
    .greet h1 { font-size: 19px; }
    .greet .divider, .greet .total { display: none; }
    .tabs-row { margin: 12px 12px 6px; }
    .tabs a { font-size: 13.5px; padding: 8px 4px; }
    .card { padding: 16px 14px; column-gap: 12px; grid-template-columns: 44px 1fr; }
    .card-pick, .card-pick .check, .avatar-card { width: 44px; height: 44px; }
    .card-subject { font-size: 15.5px; }
    .card-preview { font-size: 13.5px; }
    .reader-scroll { padding: 18px 16px; }
    .reader-subject { font-size: 20px; }
    .reader-from time { display: none; }
    .addr-row, .composer-files, .composer-actions, .editor, .editor-toolbar { padding-left: 14px; padding-right: 14px; }
    .settings-grid { padding: 8px 12px 16px; }
    .bulk-bar select { max-width: 110px; }
}
