:root {
  color-scheme: light;
  --ink: #18181b;
  --pine: #18181b;
  --muted: #60606a;
  --line: #e1e1e5;
  --wash: #f4f4f5;
  --paper: white;
  --focus: #52525b;
  font: 14px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  scrollbar-color: #b6b6bd white;
}
::selection { background: #dedee4; color: var(--ink); }
button:hover { background: #323237; }
.secondary, .quiet, input, textarea, select { border-color: #d4d4d8; }
.secondary:hover, .quiet:hover { background: var(--wash); }
input::placeholder, textarea::placeholder { color: #686871; }
.glyph { width: 16px; height: 16px; flex: none; vertical-align: middle; }

.signed-in { display: grid; grid-template-columns: clamp(190px, 17vw, 265px) minmax(0, 1fr); }
.stage, main { min-width: 0; }
.rail {
  position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column;
  border-right: 1px solid var(--line); background: white; overflow: auto;
}
.wordmark { display: flex; align-items: center; gap: 10px; padding: 8px 12px; margin: 9px; min-height: 37px;
  border: 1px solid var(--line); border-radius: 6px; color: var(--ink); font-size: 13px; font-weight: 720; text-decoration: none; }
.wordmark svg { width: 23px; height: 19px; }
.desktop-nav { border-top: 1px solid var(--line); }
.rail-label { margin: 14px 16px 6px; color: var(--muted); font-size: 12px; font-weight: 550; }
.rail-section { border-top: 1px solid var(--line); padding: 14px 16px 0; margin: 12px 0 6px; }
.rail-link, .profile-link { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.rail-link { margin: 2px 8px; padding: 8px 11px; min-height: 36px; border-radius: 6px; font-size: 13px; font-weight: 550; }
.rail-link small { margin-left: auto; color: inherit; font-size: 12px; font-variant-numeric: tabular-nums; }
.rail-link:hover, .wordmark:hover { background: var(--wash); }
.rail-link.current { background: var(--ink); color: white; }
.rail-account { margin-top: auto; padding: 14px 12px; display: grid; justify-items: start; gap: 7px; }
.rail-mail { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.sample, .tag, .ownership { display: inline-flex; align-items: center; padding: 2px 7px; border-radius: 5px; font-size: 11px; font-weight: 600; }
.sample, .ownership.vacant { border: 1px solid var(--line); background: white; color: #52525b; }
.rail-bottom, .topline { display: flex; align-items: center; gap: 10px; padding: 12px; }
.rail-bottom { justify-content: space-between; border-top: 1px solid var(--line); }
.profile-link { min-width: 0; overflow-wrap: anywhere; font-size: 13px; }
.profile-initial, .avatar { display: inline-grid; place-items: center; flex: none; background: var(--wash); border-radius: 50%; font-weight: 600; }
.profile-initial { width: 30px; height: 30px; font-size: 12px; }
.rail-bottom button, .mobile-panel button { background: white; border: 0; color: var(--ink); }
.topline { min-height: 55px; border-bottom: 1px solid var(--line); }
.top-name { font-weight: 650; }
.address { padding-left: 10px; border-left: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.topline .sample { margin-left: auto; }
.mail-screen .topline, .mobile-menu { display: none; }

.mail-screen .stage { display: flex; flex-direction: column; height: 100dvh; }
.mail-screen main { flex: 1; min-height: 0; }
.mail-layout { height: 100%; display: grid; grid-template-columns: clamp(330px, 32vw, 510px) minmax(0, 1fr); }
.queue, .reading-pane { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.queue { border-right: 1px solid var(--line); }
.queue-title, .reader-tools { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 55px; padding: 8px 16px; border-bottom: 1px solid var(--line); }
.queue-title h1 { font-size: 20px; font-weight: 650; letter-spacing: -.035em; }
.queue-tabs { display: flex; padding: 3px; background: var(--wash); border-radius: 7px; }
.queue-tabs a { padding: 4px 9px; font-size: 12px; font-weight: 550; color: var(--muted); text-decoration: none; border-radius: 4px; }
.queue-tabs a[aria-current] { color: var(--ink); background: white; box-shadow: 0 1px 3px #0002; }
.mail-search { position: relative; margin: 14px 16px; }
.mail-search input { height: 36px; min-height: 36px; padding-left: 35px; margin: 0; border-radius: 6px; font-size: 13px; }
.mail-search button { position: absolute; left: 1px; top: 1px; width: 33px; min-height: 34px; padding: 4px; color: var(--muted); background: transparent; border: 0; }

.conversations { margin: 0; padding: 1px 16px 16px; list-style: none; overflow-y: auto; }
.conversations li + li { margin-top: 8px; }
.conversation { position: relative; display: block; padding: 12px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); text-decoration: none; }
.conversation:hover, .conversation.chosen { background: var(--wash); }
.conversation:focus-visible { outline-offset: -3px; }
.thread-text, .from, .thread-text strong { display: block; }
.from, .thread-text strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.from { padding-right: 62px; font-size: 14px; font-weight: 650; }
.thread-text strong { font-size: 13px; font-weight: 550; }
.snippet { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; margin: 6px 0 9px; font-size: 12px; line-height: 1.45; color: var(--muted); }
.stamp { position: absolute; right: 12px; top: 13px; font-size: 11px; }
.card-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.tag { background: #ebebed; }
.ownership { background: var(--ink); color: white; gap: 4px; overflow-wrap: anywhere; }
.ownership .glyph { width: 12px; height: 12px; }
.no-mail { padding: 25px 4px; color: var(--muted); }
.no-mail h2, .idle-reader h2 { color: var(--ink); font-size: 15px; }
.idle-reader { display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 24px; color: var(--muted); }

.reader-tools a, .compact, .assign-line label, .reply-label, .reply-box button, .attachment { display: inline-flex; align-items: center; gap: 7px; }
.reader-tools a { color: var(--muted); text-decoration: none; font-size: 12px; }
.reader-tools a:hover { color: var(--ink); text-decoration: underline; }
.compact, .save { font-size: 12px; min-height: 30px; padding: 4px 9px; }
.compact { border-color: var(--line); }
.reading-content { display: flex; flex: 1; flex-direction: column; min-height: 0; }
.thread-scroll { flex: 1; overflow-y: auto; min-height: 0; }
.subject-head, .letter header, .reply-box, .reply-log { padding: 16px 20px; }
.subject-head { border-bottom: 1px solid var(--line); }
.subject-head h2 { font-size: clamp(17px, 1.45vw, 23px); line-height: 1.3; font-weight: 620; letter-spacing: -.025em; margin: 0 0 10px; overflow-wrap: anywhere; }
.assign-line { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.assign-line label { color: var(--muted); font-weight: 500; font-size: 12px; }
.assign-line select { width: auto; max-width: 100%; font-size: 12px; margin: 0; min-height: 29px; padding: 3px 6px; }
.save { background: white; color: var(--ink); border-color: var(--line); }
.save:hover { background: var(--wash); }
.letter header { display: flex; gap: 10px; align-items: flex-start; border-bottom: 1px solid var(--line); }
.avatar { width: 38px; height: 38px; font-size: 12px; }
.letter header>div { min-width: 0; overflow-wrap: anywhere; }
.letter header strong { display: block; font-size: 14px; }
.mail-address, .letter small, .letter header time { font-size: 12px; color: var(--muted); }
.letter header time { margin-left: auto; white-space: normal; text-align: right; }
.letter .body { margin: 0; padding: 17px 20px; max-width: 78ch; font-size: 14px; line-height: 1.65; }
.attachment { margin: 0 20px 12px; }
.reply-log { border-top: 1px solid var(--line); }
.reply-log h3 { font-size: 14px; }
.reply-log article { padding-block: 10px; }
.reply-log time { white-space: normal; }
.reply-box, .reply-note { border-top: 1px solid var(--line); }
.reply-note { padding: 16px 20px; }
.reply-label, .reply-box footer span { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.reply-label { font-weight: 500; }
.reply-box textarea { min-height: 80px; padding: 10px 12px; margin: 8px 0; border-radius: 6px; font-size: 13px; max-height: 30dvh; }
.reply-box footer { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.reply-box button { min-height: 33px; font-size: 12px; }
@media (max-width: 890px) {
  .signed-in { display: block; }
  .rail { display: none; }
  .mail-screen .topline { display: flex; }
  .mobile-menu { display: block; position: relative; }
  .mobile-menu summary { display: grid; place-items: center; width: 32px; height: 32px; list-style: none; }
  .mobile-menu summary::-webkit-details-marker { display: none; }
  .mobile-panel { position: absolute; top: 38px; z-index: 3; width: 215px; background: white; border: 1px solid var(--line); border-radius: 8px; padding-bottom: 8px; box-shadow: 0 6px 20px #0001; }
}
@media (max-width: 680px) {
  .mail-layout { display: block; }
  .mail-screen .stage { height: auto; min-height: 100dvh; }
  .queue { border: 0; }
  .idle-reader, .reading .queue, .address { display: none; }
  .thread-scroll, .conversations { overflow: visible; }
  .reading-pane { min-height: calc(100dvh - 58px); }
  .queue-title, .reader-tools { min-height: 49px; }
  .subject-head, .letter header, .reply-box { padding: 14px 16px; }
  .letter .body { padding-inline: 16px; }
  .queue-tabs a { padding: 6px 10px; }
  .assign-line select, .save, .compact { min-height: 36px; }
}

.desktop-nav { min-height: 0; overflow-y: auto; }
.wordmark,.rail-account,.rail-bottom { flex-shrink:0; }
.desktop-nav .rail-link { min-height: 31px; padding-block: 5px; }
.compose-link,.button-link { display:inline-flex; align-items:center; justify-content:center; gap:8px; background:var(--ink); color:white; border-radius:6px; padding:8px 14px; text-decoration:none; font-weight:600; }
.compose-link { display:flex; margin:12px 9px; }
.sheet { width:min(100%,840px); margin:0 auto; padding:clamp(20px,4vw,58px); }
.sheet h1 { font-size:clamp(24px,3vw,34px); }
.sheet h2 { margin-block:15px 6px; }
.sheet hr { border:0; border-top:1px solid var(--line); margin:24px 0; }
.sheet p { margin:9px 0 16px; }
.write-form { display:grid; gap:13px; }
.write-form input,.write-form textarea,.sheet input { border-color:var(--line); }
.action-row,.tool-group { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.action-menu { position:relative; }
.action-menu summary { list-style:none; color:var(--ink); font-size:12px; border:1px solid var(--line); border-radius:5px; padding:5px 8px; }
.action-menu summary::-webkit-details-marker { display:none; }
.action-menu[open] { z-index:3; }
.action-menu[open]>form { position:absolute; right:0; top:100%; z-index:2; width:194px; padding:5px; border:1px solid var(--line); border-radius:6px; background:white; box-shadow:0 4px 18px #0002; }
.action-menu form button,.action-menu form a { display:block; width:100%; text-align:left; color:var(--ink); background:white; padding:5px 8px; min-height:28px; border:0; font-size:12px; }
.action-menu form button:hover,.action-menu form a:hover { background:var(--wash); }
.action-menu form label { display:block; padding:5px 8px; }
.record { display:block; padding:14px 0; border-bottom:1px solid var(--line); color:var(--ink); text-decoration:none; overflow-wrap:anywhere; }
.record time { float:right; }
.record a { font-size:13px; }
.qr { width:190px; background:white; }
.auth-sheet { max-width:560px; }
.code-grid { display:grid; grid-template-columns:1fr 1fr; gap:9px; margin:18px 0; }
.code-grid code { padding:8px; background:var(--wash); }
.mobile-panel { max-height:75dvh; overflow:auto; }
@media(max-width:680px){.page,.sheet{min-width:0}.tool-group{gap:4px}.action-menu[open]>form{right:-36px}.record time{float:none;display:block}}
.folder-disclosure summary {margin:4px 10px;padding:4px 8px;font-size:12px;color:var(--muted)}
.action-menu form {max-height:min(60dvh,440px);overflow-y:auto}
.role-matrix td,.role-matrix th{vertical-align:middle;padding:12px}
.role-matrix td{text-align:center}.role-matrix th:not(:first-child){text-align:center}
.page-turn{padding:8px 16px}
.user-row{grid-template-columns:minmax(135px,1fr) minmax(0,2.2fr)}
.user-row select,.panel select{max-width:230px;margin:5px 0 10px}
@media(max-width:680px){.user-row{grid-template-columns:1fr}.role-matrix{min-width:620px}}
fieldset:disabled { opacity:.72; }
/* Beta connection status remains outside the replaceable mail reader. */
.mail-sync-status{display:flex;flex-wrap:wrap;flex-shrink:0;gap:.5rem 1rem;align-items:center;justify-content:space-between;padding:.55rem 1rem;border-bottom:1px solid var(--line);font-size:.8rem}
.mail-sync-status[data-state="current"]{opacity:.75}
.mail-sync-status[data-state="attention"],.mail-sync-status[data-state="stale"],.mail-sync-status[data-state="waiting"]{font-weight:600}
.mail-sync-status button{font-size:inherit;white-space:nowrap}
