:root {
  --ink: #142033;
  --muted: #6c7a90;
  --faint: #94a0b2;
  --line: #e5eaf1;
  --canvas: #f3f6fa;
  --paper: #ffffff;
  --nav: #0b1220;
  --nav-2: #121d31;
  --blue: #2563eb;
  --blue-2: #1d4ed8;
  --blue-soft: #eaf1ff;
  --cyan: #23b6d2;
  --green: #16a46b;
  --amber: #d78016;
  --red: #d94a54;
  --shadow: 0 24px 70px rgba(16, 35, 70, .16);
  --radius: 16px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { color: var(--ink); background: var(--canvas); overflow: hidden; }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
[hidden] { display: none !important; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #d4dce7; border: 2px solid transparent; border-radius: 20px; background-clip: content-box; }

.topbar {
  position: relative;
  z-index: 60;
  height: 72px;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 0 24px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; min-width: 220px; }
.brand > span:last-child { display: flex; align-items: baseline; gap: 7px; }
.brand strong { font-size: 17px; letter-spacing: -.03em; }
.brand small { color: var(--blue); font-size: 9px; font-weight: 800; letter-spacing: .16em; }
.brand-mark {
  position: relative;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 12px;
  background: linear-gradient(145deg, #3981ff, #1d4ed8);
  box-shadow: 0 8px 20px rgba(37, 99, 235, .25);
}
.brand-mark::before { content: ""; width: 21px; height: 15px; border: 2px solid white; border-radius: 4px; }
.brand-mark::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  border-left: 2px solid white;
  border-bottom: 2px solid white;
  transform: rotate(-45deg) translate(2px, -3px);
}

.topbar-summary { display: flex; align-items: center; gap: 22px; font-size: 12px; color: var(--muted); }
.topbar-summary strong { color: var(--ink); font-size: 13px; }
.health-pill { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; border-radius: 999px; background: #f0f3f7; }
.health-pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 4px rgba(215, 128, 22, .1); }
.health-pill b { font-size: 11px; }
.health-pill.online i { background: var(--green); box-shadow: 0 0 0 4px rgba(22, 164, 107, .11); }
.health-pill.error i { background: var(--red); box-shadow: 0 0 0 4px rgba(217, 74, 84, .11); }
.topbar-actions { margin-left: auto; display: flex; gap: 9px; }

.button, .icon-button {
  border: 0;
  cursor: pointer;
  transition: transform .16s ease, background .16s ease, border-color .16s ease, opacity .16s ease;
}
.button:active, .icon-button:active { transform: translateY(1px); }
.button:disabled { opacity: .55; cursor: wait; }
.button { height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 0 15px; border-radius: 10px; font-size: 12px; font-weight: 700; border: 1px solid transparent; }
.button.primary { color: white; background: var(--blue); box-shadow: 0 7px 20px rgba(37, 99, 235, .2); }
.button.primary:hover { background: var(--blue-2); }
.button.subtle { background: #f5f7fa; border-color: var(--line); color: #48566b; }
.button.subtle:hover { background: #edf1f6; }
.button.danger { color: white; background: var(--red); }
.button.danger-soft { color: var(--red); background: #fff1f2; border-color: #ffd7dc; }
.button.microsoft { width: 100%; color: white; background: #111b2d; }
.button-icon { font-size: 17px; line-height: 1; }
.icon-button { width: 36px; height: 36px; border-radius: 10px; background: #f6f8fb; border: 1px solid var(--line); display: grid; place-items: center; font-size: 18px; }
.icon-button:hover { background: var(--blue-soft); border-color: #cfdcff; color: var(--blue); }

.workspace { height: calc(100vh - 72px); height: calc(100dvh - 72px); display: grid; grid-template-columns: 280px 400px minmax(420px, 1fr); }
.sidebar {
  position: relative;
  z-index: 40;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  color: #dce5f5;
  background:
    radial-gradient(circle at 18% -10%, rgba(37, 99, 235, .30), transparent 38%),
    linear-gradient(165deg, var(--nav-2), var(--nav) 63%);
}
.sidebar-heading { display: flex; align-items: center; justify-content: space-between; padding: 28px 22px 16px; }
.eyebrow { display: block; color: #8290a5; font-size: 9px; font-weight: 800; letter-spacing: .17em; margin-bottom: 6px; }
.sidebar h1 { margin: 0; font-size: 20px; letter-spacing: -.04em; }
.sidebar .search-field { margin: 0 16px 16px; background: rgba(255, 255, 255, .07); border-color: rgba(255, 255, 255, .08); }
.sidebar .search-field input { color: white; }
.sidebar .search-field input::placeholder { color: #728098; }

.search-field { height: 42px; display: flex; align-items: center; gap: 9px; padding: 0 11px; background: var(--paper); border: 1px solid var(--line); border-radius: 11px; color: var(--faint); transition: border-color .16s, box-shadow .16s; }
.search-field:focus-within { border-color: #b9cafe; box-shadow: 0 0 0 3px rgba(37, 99, 235, .08); }
.search-field input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; font-size: 12px; color: var(--ink); }
.search-field kbd { min-width: 27px; padding: 3px 6px; text-align: center; border-radius: 6px; border: 0; background: #edf1f6; color: var(--muted); font: 700 10px/1.2 inherit; }
.search-field.compact { height: 40px; }

.inbox-filter {
  margin: 0 12px 14px;
  min-height: 58px;
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 10px;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 13px;
  background: transparent;
  color: #d6dfed;
  cursor: pointer;
}
.inbox-filter:hover, .inbox-filter.active { background: rgba(255, 255, 255, .09); border-color: rgba(255, 255, 255, .08); }
.filter-icon { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 10px; color: #b9d5ff; background: rgba(37, 99, 235, .28); }
.inbox-filter span:nth-child(2) { display: flex; flex-direction: column; gap: 3px; }
.inbox-filter b { font-size: 12px; }
.inbox-filter small { color: #718099; font-size: 10px; }
.inbox-filter > strong { min-width: 23px; padding: 3px 6px; border-radius: 20px; color: #c7dbff; background: rgba(37, 99, 235, .28); text-align: center; font-size: 10px; }
.section-label { display: flex; align-items: center; justify-content: space-between; padding: 0 20px 8px; color: #68778f; font-size: 9px; font-weight: 800; letter-spacing: .13em; }
.section-label b { letter-spacing: 0; }
.account-list { flex: 1; min-height: 0; padding: 0 9px 20px; overflow-y: auto; }
.account-item {
  position: relative;
  width: 100%;
  display: grid;
  grid-template-columns: 35px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  margin-bottom: 3px;
  text-align: left;
  color: #d8e1ef;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
}
.account-item:hover, .account-item.active { background: rgba(255, 255, 255, .075); border-color: rgba(255, 255, 255, .07); }
.account-item.active::before { content: ""; position: absolute; left: -9px; top: 15px; bottom: 15px; width: 3px; border-radius: 4px; background: #66a0ff; }
.account-avatar { width: 35px; height: 35px; display: grid; place-items: center; border-radius: 11px; font-size: 12px; font-weight: 800; color: #bcd5ff; background: linear-gradient(145deg, rgba(59, 130, 246, .28), rgba(37, 99, 235, .11)); }
.account-copy { min-width: 0; }
.account-copy b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.account-copy small { display: flex; align-items: center; gap: 5px; margin-top: 5px; color: #718098; font-size: 9px; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: #708098; }
.status-dot.healthy { background: #36c88b; }
.status-dot.syncing { background: #56a4ff; animation: blink 1s infinite; }
.status-dot.error { background: #ff6b75; }
.account-meta-right { display: flex; align-items: center; gap: 5px; }
.account-badge { min-width: 22px; padding: 3px 6px; border-radius: 20px; color: #cbe0ff; background: rgba(37, 99, 235, .3); font-size: 9px; text-align: center; }
.account-menu { width: 26px; height: 26px; border: 0; border-radius: 8px; color: #7f8da3; background: transparent; cursor: pointer; opacity: 0; }
.account-item:hover .account-menu, .account-menu:focus { opacity: 1; }
.account-popover { position: fixed; z-index: 100; width: 172px; padding: 6px; border: 1px solid var(--line); border-radius: 12px; background: white; box-shadow: var(--shadow); }
.account-popover button { width: 100%; padding: 9px 10px; border: 0; border-radius: 8px; background: transparent; text-align: left; font-size: 11px; cursor: pointer; }
.account-popover button:hover { background: #f2f5f9; }
.account-popover button.danger-text { color: var(--red); }
.sidebar-footer { padding: 13px 15px calc(13px + env(safe-area-inset-bottom)); border-top: 1px solid rgba(255, 255, 255, .07); }
.sidebar-footer-button { width: 100%; height: 39px; color: #aab8cc; border: 1px dashed rgba(255, 255, 255, .16); border-radius: 10px; background: rgba(255, 255, 255, .035); cursor: pointer; font-size: 11px; font-weight: 700; }
.sidebar-footer-button:hover { color: white; border-color: rgba(255, 255, 255, .28); }

.mail-column { min-width: 0; display: flex; flex-direction: column; background: #f7f9fc; border-right: 1px solid var(--line); }
.mail-toolbar { min-height: 86px; display: flex; align-items: center; justify-content: space-between; padding: 18px 18px 12px 22px; }
.mail-title-wrap { display: flex; align-items: center; gap: 8px; min-width: 0; }
.mail-title-wrap h2 { max-width: 270px; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 19px; letter-spacing: -.035em; }
.mail-title-wrap .eyebrow { color: var(--blue); }
.toolbar-actions { display: flex; gap: 6px; }
.mail-search-row { padding: 0 16px 14px; border-bottom: 1px solid var(--line); }
.mail-list { flex: 1; min-height: 0; overflow-y: auto; }
.mail-item {
  position: relative;
  width: 100%;
  display: block;
  padding: 16px 19px 15px 22px;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .62);
  cursor: pointer;
  transition: background .15s;
}
.mail-item:hover { background: white; }
.mail-item.active { background: white; box-shadow: inset 3px 0 var(--blue); }
.mail-item.unread::before { content: ""; position: absolute; left: 9px; top: 22px; width: 6px; height: 6px; border-radius: 50%; background: var(--blue); }
.mail-row-top { display: flex; align-items: center; gap: 9px; }
.mail-from { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #425066; font-size: 12px; font-weight: 650; }
.mail-item.unread .mail-from { color: var(--ink); font-weight: 800; }
.mail-time { color: var(--faint); font-size: 9px; white-space: nowrap; }
.mail-subject { margin-top: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 700; color: #263349; }
.mail-preview { margin: 5px 0 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 10px; line-height: 1.5; }
.mail-tag { display: inline-flex; margin-top: 9px; max-width: 100%; padding: 4px 7px; border-radius: 6px; color: #6b7890; background: #eef2f7; font-size: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.reader { min-width: 0; overflow: hidden; background: var(--paper); }
.reader-empty { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 30px; text-align: center; }
.empty-illustration { position: relative; width: 105px; height: 80px; display: grid; place-items: center; margin-bottom: 23px; border-radius: 24px; color: var(--blue); background: linear-gradient(145deg, #edf3ff, #f8faff); box-shadow: inset 0 0 0 1px #e4ecfb; }
.empty-illustration::before, .empty-illustration::after { content: ""; position: absolute; border-radius: 20px; background: #edf3ff; z-index: -1; }
.empty-illustration::before { width: 72px; height: 72px; left: -26px; top: 25px; opacity: .65; }
.empty-illustration::after { width: 48px; height: 48px; right: -18px; top: -14px; opacity: .7; }
.empty-illustration span { font-size: 34px; }
.reader-empty h3 { margin: 0 0 8px; font-size: 17px; letter-spacing: -.03em; }
.reader-empty p { max-width: 330px; margin: 0; color: var(--muted); font-size: 11px; line-height: 1.75; }
.reader-content { height: 100%; display: flex; flex-direction: column; }
.reader-header { padding: 32px 38px 24px; border-bottom: 1px solid var(--line); }
.reader-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 13px; }
.message-label { color: var(--blue); font-size: 9px; font-weight: 800; letter-spacing: .16em; }
.reader-header > h2 { max-width: 900px; margin: 0 0 24px; font-size: clamp(19px, 2vw, 27px); line-height: 1.24; letter-spacing: -.045em; }
.sender-card { display: grid; grid-template-columns: 41px minmax(0, auto) 1fr; align-items: center; gap: 11px; }
.sender-avatar { width: 41px; height: 41px; display: grid; place-items: center; border-radius: 13px; color: white; background: linear-gradient(145deg, #27b4d1, #2563eb); font-size: 14px; font-weight: 800; }
.sender-card > div { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.sender-card strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.sender-card small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 10px; }
.sender-card time { justify-self: end; color: var(--muted); font-size: 10px; }
.recipient-line { margin: 12px 0 0 52px; color: var(--faint); font-size: 9px; }
.recipient-line b { color: var(--muted); font-weight: 600; }
.reader-body { flex: 1; min-height: 0; padding: 25px 38px 40px; overflow-y: auto; }
#reader-frame { width: 100%; height: 100%; min-height: 480px; border: 0; background: white; }
#reader-text { margin: 0; white-space: pre-wrap; color: #334155; font: 13px/1.8 ui-monospace, SFMono-Regular, Menlo, monospace; }

.empty-list { display: flex; min-height: 280px; flex-direction: column; align-items: center; justify-content: center; padding: 30px; color: var(--muted); text-align: center; }
.empty-list span { width: 50px; height: 50px; display: grid; place-items: center; margin-bottom: 12px; border-radius: 16px; color: var(--blue); background: var(--blue-soft); font-size: 22px; }
.empty-list b { font-size: 12px; }
.empty-list small { margin-top: 6px; font-size: 10px; line-height: 1.6; }
.error-banner { margin: 10px; padding: 11px 12px; border: 1px solid #ffd7dc; border-radius: 10px; color: #9f3038; background: #fff4f5; font-size: 10px; line-height: 1.5; }

.loading-stack { padding: 4px 7px; }
.loading-stack i { display: block; height: 53px; margin: 7px 0; border-radius: 11px; background: linear-gradient(90deg, rgba(255,255,255,.04), rgba(255,255,255,.10), rgba(255,255,255,.04)); background-size: 220% 100%; animation: shimmer 1.4s infinite; }
.loading-stack.roomy i { height: 78px; margin: 0; border-radius: 0; border-bottom: 1px solid var(--line); background: linear-gradient(90deg, #f2f5f9, #fff, #f2f5f9); background-size: 220% 100%; }
@keyframes shimmer { to { background-position: -220% 0; } }
@keyframes blink { 50% { opacity: .25; } }

.modal-layer {
  position: fixed;
  z-index: 200;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: rgba(6, 13, 25, .55);
  backdrop-filter: blur(9px);
}
.modal-layer.visible { display: flex; animation: fade .16s ease; }
.modal-card { width: min(480px, 100%); max-height: min(760px, 92vh); overflow-y: auto; padding: 25px; border: 1px solid rgba(255,255,255,.7); border-radius: 20px; background: var(--paper); box-shadow: var(--shadow); animation: rise .2s ease; }
.modal-card.wide { width: min(640px, 100%); }
.modal-card.small { width: min(390px, 100%); text-align: center; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 20px; }
.modal-head h2, .modal-card.small h2 { margin: 0; font-size: 21px; letter-spacing: -.04em; }
.modal-head .eyebrow { color: var(--blue); }
.segmented { display: flex; gap: 4px; padding: 4px; margin-bottom: 20px; border-radius: 12px; background: #f0f3f7; }
.segmented button { flex: 1; height: 38px; border: 0; border-radius: 9px; color: var(--muted); background: transparent; font-size: 11px; font-weight: 700; cursor: pointer; }
.segmented button.active { color: var(--ink); background: white; box-shadow: 0 4px 12px rgba(26, 44, 75, .08); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.notice { display: grid; grid-template-columns: auto 1fr; gap: 12px; padding: 13px 14px; margin-bottom: 18px; border: 1px solid #d7e3ff; border-radius: 12px; color: #3d5f9e; background: #f1f6ff; font-size: 10px; line-height: 1.6; }
.notice b { color: var(--blue); }
.notice.neutral { color: var(--muted); background: #f7f9fb; border-color: var(--line); }
.notice.neutral b { color: var(--ink); }
.form-grid { display: grid; gap: 13px; }
.form-grid.two { grid-template-columns: 1fr 1.4fr; }
.form-grid label, .select-field, .textarea-field { display: flex; flex-direction: column; gap: 7px; color: #4f5d70; font-size: 10px; font-weight: 700; }
.form-grid input, .form-grid select, .select-field select, .textarea-field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: 0;
  color: var(--ink);
  background: #fbfcfe;
}
.form-grid input, .form-grid select, .select-field select { height: 42px; padding: 0 11px; font-size: 11px; }
.textarea-field textarea { resize: vertical; min-height: 170px; padding: 12px; font: 10px/1.7 ui-monospace, SFMono-Regular, Menlo, monospace; }
.form-grid input:focus, .form-grid select:focus, .select-field select:focus, .textarea-field textarea:focus { border-color: #b5c7ff; box-shadow: 0 0 0 3px rgba(37, 99, 235, .07); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.device-code-card { margin-top: 17px; padding: 18px; border: 1px solid var(--line); border-radius: 14px; text-align: center; background: #f8fafd; }
.device-code-card > small { color: var(--muted); font-size: 10px; }
.device-code { display: block; width: 100%; padding: 7px 0; border: 0; background: transparent; color: var(--blue); font: 800 28px/1.3 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .16em; cursor: copy; }
.device-code-card p { margin: 5px 0 14px; color: var(--muted); font-size: 10px; line-height: 1.6; }
.status-line { display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 14px; color: var(--muted); font-size: 10px; }
.pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--blue); box-shadow: 0 0 0 4px rgba(37, 99, 235, .1); animation: blink 1.2s infinite; }
.import-result { margin-top: 12px; padding: 11px 12px; border-radius: 10px; font-size: 10px; line-height: 1.6; background: #f3f6fa; }
.export-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 17px; }
.export-grid button { min-height: 105px; display: grid; grid-template-columns: 40px 1fr; grid-template-rows: auto auto; align-content: center; column-gap: 11px; padding: 14px; text-align: left; border: 1px solid var(--line); border-radius: 13px; background: #fbfcfe; cursor: pointer; }
.export-grid button:hover { border-color: #b8c9fd; background: #f4f7ff; }
.file-icon { grid-row: 1 / 3; width: 39px; height: 47px; display: grid; place-items: center; border-radius: 8px; color: #a25915; background: #fff2dc; font-size: 8px; font-weight: 900; }
.file-icon.csv { color: #14734b; background: #e4f8ee; }
.file-icon.key { color: #285fc1; background: #e8f0ff; }
.export-grid b { align-self: end; font-size: 11px; }
.export-grid small { color: var(--muted); font-size: 9px; }
.modal-copy { color: var(--muted); font-size: 11px; line-height: 1.7; }
.copy-field { height: 44px; display: flex; overflow: hidden; border: 1px solid #bdcdfd; border-radius: 10px; background: #f6f8ff; }
.copy-field input { min-width: 0; flex: 1; border: 0; outline: 0; padding: 0 11px; color: #47618f; background: transparent; font: 10px ui-monospace, SFMono-Regular, Menlo, monospace; }
.copy-field button { width: 70px; border: 0; color: white; background: var(--blue); cursor: pointer; font-size: 10px; font-weight: 800; }
.share-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 15px; }
.danger-symbol { width: 48px; height: 48px; display: grid; place-items: center; margin: 0 auto 15px; border-radius: 50%; color: var(--red); background: #fff0f1; font-size: 21px; font-weight: 900; }

.toast-region { position: fixed; z-index: 300; right: 20px; bottom: 20px; width: min(360px, calc(100vw - 30px)); display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { display: grid; grid-template-columns: 28px 1fr; gap: 10px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 13px; background: rgba(255,255,255,.96); box-shadow: 0 15px 40px rgba(16,35,70,.15); animation: slide .24s ease; }
.toast > span { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 9px; color: var(--blue); background: var(--blue-soft); font-weight: 900; }
.toast.error > span { color: var(--red); background: #fff0f1; }
.toast.success > span { color: var(--green); background: #eaf9f3; }
.toast b { display: block; font-size: 11px; }
.toast small { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; line-height: 1.5; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(12px) scale(.985); } }
@keyframes slide { from { opacity: 0; transform: translateX(15px); } }

.mobile-only, .mobile-nav, .sidebar-scrim { display: none; }

.public-topbar .brand { min-width: 205px; }
.public-account { min-width: 0; }
.public-account .eyebrow { color: var(--blue); margin-bottom: 3px; }
.public-account strong { display: block; max-width: min(46vw, 520px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.public-shell { height: calc(100vh - 72px); height: calc(100dvh - 72px); display: grid; grid-template-columns: minmax(340px, 410px) minmax(0, 1fr); }
.public-list-column { border-left: 1px solid var(--line); }
.public-sync-time { color: var(--muted); font-size: 9px; white-space: nowrap; }
.public-reader { min-width: 0; }
.invalid-page { position: fixed; inset: 72px 0 0; display: grid; place-items: center; padding: 24px; background: var(--canvas); }
.invalid-card { width: min(420px, 100%); padding: 34px; border: 1px solid var(--line); border-radius: 20px; background: white; text-align: center; box-shadow: var(--shadow); }
.invalid-card h1 { margin: 0 0 9px; font-size: 22px; letter-spacing: -.04em; }
.invalid-card p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.75; }

@media (max-width: 1120px) {
  .workspace { grid-template-columns: 250px 360px minmax(390px, 1fr); }
  .brand { min-width: 190px; }
  .topbar-summary > span:not(.health-pill) { display: none; }
  .reader-header { padding-inline: 28px; }
  .reader-body { padding-inline: 28px; }
}

@media (max-width: 820px) {
  body { overflow: hidden; }
  .mobile-only { display: inline-grid; }
  .topbar { height: 60px; gap: 9px; padding: 0 12px; }
  .brand { min-width: 0; }
  .brand-mark { width: 34px; height: 34px; }
  .brand small, .topbar-summary, .desktop-action { display: none !important; }
  .topbar-actions { gap: 6px; }
  .button { height: 37px; padding: 0 11px; }
  .workspace { height: calc(100vh - 118px); height: calc(100dvh - 118px); display: block; position: relative; }
  .sidebar {
    position: fixed;
    inset: 60px auto 58px 0;
    width: min(86vw, 310px);
    transform: translateX(-102%);
    transition: transform .24s ease;
    box-shadow: 20px 0 50px rgba(5, 13, 28, .28);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-scrim { position: fixed; z-index: 35; inset: 60px 0 58px; background: rgba(5,13,28,.45); backdrop-filter: blur(3px); }
  .sidebar-scrim.visible { display: block; }
  .sidebar .mobile-only { color: #a5b2c5; background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.08); }
  .mail-column { position: absolute; inset: 0; width: 100%; border: 0; transition: transform .22s ease; }
  .mail-column.behind { transform: translateX(-24%); }
  .mail-toolbar { min-height: 74px; padding: 12px 14px 9px; }
  .mail-search-row { padding: 0 12px 11px; }
  .mail-item { padding: 15px 17px 14px 21px; }
  .reader { position: absolute; z-index: 20; inset: 0; transform: translateX(102%); transition: transform .24s ease; }
  .reader.open { transform: translateX(0); }
  .reader-header { padding: 16px 17px 17px; }
  .reader-header > h2 { margin-bottom: 18px; font-size: 19px; }
  .sender-card { grid-template-columns: 38px minmax(0,1fr); }
  .sender-avatar { width: 38px; height: 38px; }
  .sender-card time { grid-column: 2; justify-self: start; }
  .recipient-line { margin-left: 49px; }
  .reader-body { padding: 18px 17px 28px; }
  #reader-frame { min-height: 100%; }
  .mobile-nav {
    position: fixed;
    z-index: 70;
    inset: auto 0 0;
    height: calc(58px + env(safe-area-inset-bottom));
    display: flex;
    padding-bottom: env(safe-area-inset-bottom);
    border-top: 1px solid var(--line);
    background: rgba(255,255,255,.96);
    backdrop-filter: blur(14px);
  }
  .mobile-nav button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border: 0; color: #8592a5; background: transparent; font-size: 8px; font-weight: 700; }
  .mobile-nav button span { font-size: 17px; line-height: 1; }
  .mobile-nav button.active { color: var(--blue); }
  .modal-layer { align-items: flex-end; padding: 0; }
  .modal-card, .modal-card.wide, .modal-card.small { width: 100%; max-height: 91vh; border-radius: 22px 22px 0 0; padding: 21px 18px calc(21px + env(safe-area-inset-bottom)); }
  .form-grid.two { grid-template-columns: 1fr; }
  .export-grid { grid-template-columns: 1fr 1fr; }
  .toast-region { right: 15px; bottom: calc(70px + env(safe-area-inset-bottom)); }
  .account-menu { opacity: 1; }
  .public-topbar .brand { min-width: 0; }
  .public-account { flex: 1; }
  .public-account .eyebrow { display: none; }
  .public-account strong { max-width: 40vw; font-size: 10px; }
  .public-shell { height: calc(100vh - 60px); height: calc(100dvh - 60px); display: block; position: relative; }
  .public-list-column { position: absolute; inset: 0; width: 100%; border: 0; transition: transform .22s ease; }
  .public-list-column.behind { transform: translateX(-24%); }
  .public-reader { position: absolute; z-index: 20; inset: 0; transform: translateX(102%); transition: transform .24s ease; background: white; }
  .public-reader.open { transform: translateX(0); }
  .public-page .mobile-nav { display: none; }
  .invalid-page { inset: 60px 0 0; }
}

@media (max-width: 430px) {
  .brand strong { font-size: 15px; }
  .topbar .button.primary span:last-child { display: none; }
  .topbar .button.primary { width: 38px; padding: 0; }
  .export-grid { grid-template-columns: 1fr; }
  .export-grid button { min-height: 83px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
