:root {
  color-scheme: dark;
  --bg: #171d22;
  --rail: #181f25;
  --panel: #1b2228;
  --raised: #222a31;
  --line: #30383f;
  --text: #f1f4f6;
  --secondary: #c0c8ce;
  --muted: #9ca8b1;
  --accent: #9ed8f7;
  --accent-rgb: 158 216 247;
  --accent-readable: #9ed8f7;
  --on-accent: #000000;
  --danger: #ff9b9b;
  --radius: 10px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--text); font-size: 14px; overflow: hidden; }
button, input, select, textarea { font: inherit; }
button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
button, select { cursor: pointer; }
button { color: inherit; }
button:disabled { cursor: not-allowed; opacity: .5; }
button, a, input, textarea, select { transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease; }
:focus-visible { outline: 2px solid var(--accent-readable); outline-offset: 4px; }
input, select, textarea { min-width: 0; color: var(--text); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
button { border: 1px solid transparent; background: transparent; }
button:hover { background: #ffffff08; }
a { color: inherit; text-decoration: none; }
.brand-mark { display: inline-block; width: 48px; aspect-ratio: 4 / 3; flex: 0 0 auto; background: var(--accent); -webkit-mask: url("/assets/rhino-mail-mark.svg") center / contain no-repeat; mask: url("/assets/rhino-mail-mark.svg") center / contain no-repeat; }
.brand-name { color: var(--text); font-size: 15px; font-weight: 600; letter-spacing: .2em; white-space: nowrap; }
.brand-name > span { color: var(--accent-readable); font-weight: 400; }
.eyebrow { margin: 0 0 12px; color: var(--muted); font-size: 10px; font-weight: 600; letter-spacing: .16em; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 12px; min-height: 44px; padding: 10px 19px; border: 1px solid var(--line); border-radius: 7px; font-weight: 500; background: var(--raised); }
.button:hover { background: #2b353e; }
.primary { background: var(--accent); color: var(--on-accent); border-color: #ffffff26; }
.primary:hover { background: var(--accent); outline: 1px solid var(--accent-readable); outline-offset: 3px; }
.primary:active { transform: translateY(1px); }
.icon-button { display: inline-grid; place-items: center; width: 42px; height: 42px; padding: 0; border-radius: 7px; color: var(--secondary); font-size: 28px; font-weight: 300; }
.quiet-action { color: var(--secondary); background: transparent; border-color: transparent; }
.quiet-action:hover { background: #ffffff08; }
.danger { color: var(--danger); border-color: #ff9b9b55; }
.gate { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 24px; text-align: center; }
.gate-mark { width: clamp(210px, 26vw, 310px); margin-bottom: 32px; }
.gate .brand-name { font-size: clamp(22px, 3vw, 30px); letter-spacing: .3em; margin: 0; }
.gate-copy { color: var(--secondary); margin: 22px 0 34px; font-size: 16px; }
.gate .button { min-width: 260px; min-height: 48px; }
.gate-status { min-height: 20px; margin: 18px 0 0; font-size: 12px; color: var(--muted); }
.desk { animation: reveal 220ms ease both; }
.masthead { height: 84px; display: grid; grid-template-columns: 234px minmax(260px, 510px) 1fr; align-items: center; gap: 24px; padding: 0 28px; border-bottom: 1px solid var(--line); background: var(--bg); }
.wordmark { display: flex; align-items: center; gap: 16px; }
.wordmark .brand-mark { width: 44px; }
.wordmark .brand-name { font-size: 13px; letter-spacing: .16em; }
.mast-search { display: flex; align-items: center; gap: 12px; height: 42px; padding: 0 14px; background: #ffffff03; border: 1px solid var(--line); border-radius: 7px; color: var(--muted); }
.mast-search:focus-within { border-color: var(--accent-readable); }
.mast-search input { width: 100%; height: 100%; border: 0; outline: 0; background: transparent; }
.mast-search svg { width: 18px; height: 18px; }
kbd { font-family: inherit; font-size: 11px; color: var(--muted); white-space: nowrap; border: 1px solid var(--line); border-radius: 4px; padding: 3px 5px; }
.mast-status { display: flex; align-items: center; justify-content: flex-end; gap: 12px; white-space: nowrap; color: var(--muted); font-size: 12px; }
.presence { width: 6px; height: 6px; border-radius: 50%; background: var(--accent-readable); }
.presence.busy { animation: presence 1.2s ease-in-out infinite; }
.mast-divider { height: 26px; width: 1px; background: var(--line); margin: 0 6px; }
.identity { width: 38px; height: 38px; padding: 0; border-radius: 50%; background: var(--raised); border: 1px solid var(--line); color: var(--secondary); font-size: 12px; font-weight: 600; }
.appearance-open { color: var(--accent-readable); }
.workspace { display: grid; grid-template-columns: 248px 370px minmax(0, 1fr); height: calc(100dvh - 84px); }
.rail { min-height: 0; display: flex; flex-direction: column; gap: 28px; padding: 28px 18px 22px; background: var(--rail); border-right: 1px solid var(--line); }
.compose-button { display: flex; align-items: center; justify-content: flex-start; gap: 18px; width: 100%; min-height: 48px; padding: 0 18px; border-radius: 7px; font-size: 14px; font-weight: 600; }
.compose-button svg { width: 20px; height: 20px; }
.mailboxes { display: grid; gap: 5px; overflow-y: auto; }
.mailbox { min-height: 46px; display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: 14px; padding: 0 14px; border-radius: 7px; text-align: left; color: var(--secondary); }
.mailbox svg { width: 20px; height: 20px; color: var(--muted); }
.mailbox small { color: var(--muted); font-size: 11px; }
.mailbox.active { background: rgb(var(--accent-rgb) / .09); box-shadow: inset 2px 0 var(--accent-readable); color: var(--text); }
.mailbox.active svg { color: var(--accent-readable); }
.mailbox.active small { color: var(--text); }
.rail-footer { margin-top: auto; }
.agent-state { border-top: 1px solid var(--line); padding: 23px 8px 20px; }
.agent-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 14px; color: var(--muted); font-size: 9px; letter-spacing: .045em; }
.agent-line b { color: var(--accent-readable); font-size: 9px; font-weight: 600; }
.agent-line b.off { color: var(--muted); }
.stop-control { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 58px; padding: 10px 12px; border: 1px solid #ff9b9b30; border-radius: 7px; text-align: left; }
.stop-glyph { color: var(--danger); font-size: 11px; }
.stop-control b { display: block; font-size: 10px; letter-spacing: .1em; font-weight: 500; }
.stop-control small { display: block; color: var(--muted); font-size: 10px; margin-top: 5px; }
.stop-control.stopped { opacity: 1; color: var(--danger); background: #ff9b9b0b; }
.correspondence { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--panel); border-right: 1px solid var(--line); }
.list-head { display: flex; align-items: center; justify-content: space-between; flex: 0 0 90px; gap: 12px; padding: 0 25px; border-bottom: 1px solid var(--line); }
.list-title-row { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.list-title-row h1 { font-size: 21px; line-height: 1.3; font-weight: 600; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; letter-spacing: -.025em; }
#list-count { color: var(--muted); font-size: 13px; }
.plain-badge { color: var(--muted); font-size: 8px; letter-spacing: .12em; white-space: nowrap; }
.message-list { flex: 1; min-height: 0; padding: 8px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #414b54 transparent; }
.message-row { position: relative; width: 100%; display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 12px; min-height: 116px; padding: 22px 12px; border-bottom: 1px solid var(--line); border-radius: 0; text-align: left; }
.message-row:last-child { border-bottom-color: transparent; }
.message-row.active { background: rgb(var(--accent-rgb) / .08); border-radius: 7px; box-shadow: inset 2px 0 var(--accent-readable); border-bottom-color: transparent; }
.row-avatar, .avatar { display: inline-grid; place-items: center; border: 1px solid #ffffff12; border-radius: 50%; background: #ffffff06; width: 34px; height: 34px; font-size: 11px; font-weight: 500; color: var(--secondary); }
.message-row.unread .row-avatar { background: var(--panel); color: var(--accent-readable); }
.message-row.unread::after { content: ""; position: absolute; width: 5px; height: 5px; left: 27px; top: 66px; background: var(--accent-readable); border-radius: 50%; }
.row-copy { display: grid; min-width: 0; gap: 6px; }
.row-top { display: flex; justify-content: space-between; gap: 12px; min-width: 0; }
.row-sender { font-size: 12px; color: var(--text); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.row-time { color: var(--muted); font-size: 10px; white-space: nowrap; padding-top: 1px; }
.row-subject, .row-preview { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; line-height: 1.5; }
.row-subject { color: var(--secondary); }
.unread .row-subject { color: var(--text); font-weight: 500; }
.row-preview { color: var(--muted); }
.empty-list { min-height: 70%; margin: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; color: var(--muted); font-size: 13px; }
.empty-list svg { width: 46px; height: 46px; stroke-width: .8; color: #65727c; }
.dispatch { min-width: 0; min-height: 0; background: var(--bg); overflow: auto; scrollbar-width: thin; scrollbar-color: #414b54 transparent; }
.tray-empty { height: 100%; min-height: 370px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 20px; text-align: center; }
.dispatch-mark { width: clamp(150px, 19vw, 256px); margin-bottom: 28px; }
.empty-brand { font-size: clamp(14px, 1.5vw, 21px); letter-spacing: .25em; }
.tray-empty h2 { margin: 48px 0 10px; font-size: 16px; font-weight: 500; color: var(--secondary); }
.tray-empty p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.9; }
.message { min-height: 100%; animation: reader-in 180ms ease-out both; }
.message-toolbar { height: 66px; display: flex; align-items: center; gap: 8px; padding: 0 26px; border-bottom: 1px solid var(--line); }
.message-toolbar button { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 7px; color: var(--secondary); }
.message-toolbar svg { width: 18px; height: 18px; }
.toolbar-spacer { flex: 1; }
.message-content { max-width: 980px; padding: 36px 38px 56px; }
.message-head h1 { margin: 0 0 28px; font-size: clamp(21px, 2vw, 26px); font-weight: 550; line-height: 1.35; letter-spacing: -.025em; overflow-wrap: anywhere; }
.address-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.address-block { display: flex; align-items: center; gap: 12px; min-width: 0; }
.address-block > div { min-width: 0; }
.avatar { width: 38px; height: 38px; flex: 0 0 auto; }
.address-block b { display: block; font-size: 12px; font-weight: 500; }
.address-block small { display: block; color: var(--muted); margin-top: 5px; font-size: 11px; overflow-wrap: anywhere; }
#message-date { font-size: 10px; color: var(--muted); white-space: nowrap; }
.message-body { font: inherit; font-size: 14px; line-height: 1.9; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--secondary); margin: 44px 0 38px; }
.message-actions .button { color: var(--secondary); background: transparent; }
.message-actions svg { width: 18px; height: 18px; }
dialog { color: var(--text); max-width: none; max-height: none; }
dialog::backdrop { background: #070b10aa; }
.composer { position: fixed; inset: 106px 24px 24px max(490px, 38vw); width: auto; height: auto; margin: 0; padding: 0; border: 1px solid #46535e; border-radius: 12px; background: var(--panel); box-shadow: 0 20px 80px #0006; }
.composer[open], .appearance-dialog[open] { animation: sheet-in 180ms ease-out both; }
.composer form { height: 100%; min-height: 0; display: grid; grid-template-rows: auto auto auto auto minmax(80px, 1fr) auto; }
.composer-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 24px; border-bottom: 1px solid var(--line); }
.composer-head h2 { font-size: 19px; font-weight: 550; margin: 0; }
.composer-field { display: grid; grid-template-columns: 80px 1fr; align-items: center; min-height: 62px; padding: 0 26px; border-bottom: 1px solid var(--line); }
.composer-field label { color: var(--muted); font-size: 12px; }
.composer-field input { width: 100%; height: 42px; border: 0; background: transparent; outline-offset: 0; }
.compose-mode { display: flex; align-items: center; gap: 16px; min-height: 50px; padding: 12px 26px; border-bottom: 1px solid var(--line); }
.compose-mode span { color: var(--accent-readable); font-size: 9px; letter-spacing: .12em; }
.compose-mode small { color: var(--muted); font-size: 10px; }
.composer textarea { min-height: 0; resize: none; border: 0; outline-offset: -5px; background: transparent; padding: 26px; font-size: 14px; line-height: 1.8; }
.composer footer { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 20px 24px; border-top: 1px solid var(--line); }
.compose-status { min-width: 0; flex: 1; margin: 0; color: var(--muted); font-size: 11px; }
.button.send { min-width: 112px; gap: 20px; }
.button.send svg { width: 18px; height: 18px; }
.confirm-dialog, .appearance-dialog { width: min(460px, calc(100vw - 32px)); padding: 28px; margin: auto; border: 1px solid #46535e; border-radius: 12px; background: var(--panel); box-shadow: 0 24px 90px #0007; max-height: calc(100dvh - 32px); overflow-y: auto; }
.confirm-dialog { border-color: #ff9b9b55; }
.confirm-dialog h2 { margin: 0 0 12px; font-size: 23px; font-weight: 550; }
.confirm-dialog p:not(.eyebrow) { color: var(--secondary); line-height: 1.7; font-size: 13px; }
.confirm-dialog form > div { display: flex; justify-content: flex-end; gap: 8px; margin-top: 26px; }
.appearance-head { display: flex; align-items: center; justify-content: space-between; }
.appearance-head .eyebrow { margin-bottom: 7px; font-size: 9px; }
.appearance-head h2 { margin: 0; font-size: 22px; font-weight: 550; letter-spacing: -.025em; }
.appearance-preview { display: flex; flex-direction: column; align-items: center; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 25px 20px 18px; margin-top: 24px; gap: 12px; }
.appearance-preview .brand-mark { width: 108px; }
.appearance-preview .brand-name { font-size: 12px; letter-spacing: .24em; }
#appearance-preview-color { color: var(--muted); font-size: 9px; letter-spacing: .08em; margin-top: 4px; }
#appearance-description { margin: 20px 0 24px; font-size: 13px; color: var(--secondary); }
.setting-label, .color-options legend { display: block; font-size: 11px; font-weight: 500; color: var(--secondary); margin-bottom: 10px; }
.appearance-dialog select { width: 100%; min-height: 42px; padding: 0 12px; border-radius: 6px; border: 1px solid #4b5863; background: var(--raised); font-size: 12px; }
.setting-note { margin: 9px 0 20px; color: var(--muted); font-size: 10px; line-height: 1.6; }
.color-options { padding: 0; margin: 0; border: 0; min-width: 0; }
.color-swatches { display: grid; grid-template-columns: repeat(9, 1fr); gap: 6px; margin: 4px 0 24px; }
.color-swatches button { min-width: 0; height: 34px; display: grid; place-items: center; border-radius: 50%; padding: 5px; position: relative; border: 1px solid transparent; }
.color-swatches button::before { content: ""; display: block; width: min(100%, 22px); aspect-ratio: 1; background: var(--swatch); border-radius: 50%; border: 1px solid #ffffff30; }
.color-swatches button[aria-pressed="true"] { border-color: var(--text); }
.color-swatches button:hover { background: #ffffff0b; }
.custom-color { display: flex; align-items: center; gap: 12px; padding: 7px 12px 7px 7px; min-height: 46px; background: var(--raised); border: 1px solid #4b5863; border-radius: 6px; }
.custom-color:focus-within { border-color: var(--accent-readable); }
.custom-color span { color: var(--muted); font-size: 9px; letter-spacing: .06em; }
#appearance-color { width: 30px; height: 30px; padding: 0; border: 0; background: transparent; flex: 0 0 auto; cursor: pointer; }
#appearance-color::-webkit-color-swatch-wrapper { padding: 0; }
#appearance-color::-webkit-color-swatch { border: 1px solid #ffffff30; border-radius: 4px; }
#appearance-hex { width: 100%; padding: 4px 0; border: 0; outline: 0; background: transparent; font-size: 12px; font-variant-numeric: tabular-nums; text-transform: uppercase; }
#appearance-hex[aria-invalid="true"] { color: var(--danger); }
.appearance-status { min-height: 16px; margin: 0 0 12px; color: var(--secondary); font-size: 11px; }
.appearance-dialog footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 16px; border-top: 1px solid var(--line); }
.appearance-dialog footer .button { font-size: 12px; }
@keyframes reveal { from { opacity: 0; } to { opacity: 1; } }
@keyframes presence { 50% { opacity: .35; } }
@keyframes reader-in { from { opacity: 0; transform: translateX(4px); } to { opacity: 1; transform: none; } }
@keyframes sheet-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (min-width: 1600px) {
  .workspace { grid-template-columns: 264px 400px minmax(0, 1fr); }
  .masthead { grid-template-columns: 250px minmax(300px, 550px) 1fr; }
}
@media (max-width: 1180px) {
  .masthead { grid-template-columns: 62px minmax(220px, 440px) 1fr; padding-inline: 20px; }
  .wordmark > .brand-name { display: none; }
  .workspace { grid-template-columns: 82px 330px minmax(0, 1fr); }
  .rail { padding-inline: 10px; gap: 24px; }
  .compose-button { justify-content: center; padding: 0; }
  .compose-button span { display: none; }
  .mailbox { grid-template-columns: 1fr; justify-items: center; padding: 0; }
  .mailbox-label, .mailbox small, .agent-state { display: none; }
  .stop-control { justify-content: center; padding: 0; }
  .stop-control > span:last-child { display: none; }
  .message-content { padding-inline: 28px; }
  .address-row { align-items: flex-start; flex-direction: column; gap: 14px; }
  .composer { left: 350px; }
}
@media (max-width: 820px) {
  body { overflow: auto; }
  body:has(dialog[open]) { overflow: hidden; }
  .masthead { position: sticky; top: 0; z-index: 6; height: 70px; grid-template-columns: 40px 1fr auto; gap: 12px; padding: 0 14px; }
  .wordmark .brand-mark { width: 34px; }
  .mast-search { height: 40px; padding-inline: 10px; }
  .mast-search kbd, #sync-label, .mast-divider, .presence { display: none; }
  .mast-status { gap: 4px; }
  .identity { width: 34px; height: 34px; }
  .appearance-open { width: 34px; height: 38px; }
  .workspace { height: calc(100dvh - 70px); grid-template-columns: 1fr; grid-template-rows: 64px minmax(0, 1fr); }
  .rail { flex-direction: row; align-items: center; gap: 6px; border-right: 0; border-bottom: 1px solid var(--line); padding: 7px 10px; overflow-x: auto; }
  .compose-button { width: 44px; min-width: 44px; min-height: 44px; }
  .mailboxes { display: flex; gap: 2px; overflow: visible; }
  .mailbox { width: 42px; min-width: 42px; min-height: 44px; }
  .rail-footer { margin: 0 0 0 auto; }
  .stop-control { width: 42px; min-width: 42px; min-height: 44px; }
  .correspondence { border-right: 0; }
  .list-head { flex-basis: 72px; padding-inline: 22px; }
  .message-list { padding-inline: 12px; }
  .message-row { min-height: 112px; }
  .dispatch { display: none; }
  body.reader-open .correspondence { display: none; }
  body.reader-open .dispatch { display: block; }
  .composer { inset: 16px; width: auto; height: auto; }
  .message-content { padding: 28px 24px 40px; }
  .address-row { flex-direction: row; align-items: center; }
}
@media (max-width: 560px) {
  .masthead { grid-template-columns: 34px minmax(0, 1fr) 72px; gap: 8px; padding-inline: 10px; }
  .mast-search { gap: 6px; font-size: 12px; }
  .mast-search svg { width: 16px; height: 16px; }
  .rail { padding-inline: 6px; gap: 4px; }
  .mailboxes { gap: 0; }
  .mailbox { width: 38px; min-width: 38px; }
  .stop-control { width: 38px; min-width: 38px; }
  .address-row { align-items: flex-start; flex-direction: column; }
  .composer { inset: 8px; }
  .composer-head { padding: 12px 16px; }
  .composer-field { padding-inline: 18px; grid-template-columns: 65px 1fr; min-height: 54px; }
  .compose-mode { padding-inline: 18px; }
  .compose-mode small { display: none; }
  .composer textarea { padding: 20px 18px; }
  .composer footer { padding: 14px; flex-wrap: wrap; }
  .compose-status:not(:empty) { flex-basis: 100%; }
  .appearance-dialog { padding: 22px; }
  .appearance-preview { padding-block: 18px; margin-top: 20px; }
  .appearance-preview .brand-mark { width: 88px; }
  .color-swatches { gap: 1px; }
  .color-swatches button { height: 32px; padding: 5px; }
  .appearance-dialog footer .button { padding-inline: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
@media (max-height: 760px) {
  .appearance-dialog { padding: 20px; }
  .appearance-preview { flex-direction: row; justify-content: center; flex-wrap: wrap; gap: 12px; margin-top: 16px; padding: 18px; }
  .appearance-preview .brand-mark { width: 58px; }
  #appearance-preview-color { flex-basis: 100%; text-align: center; margin-top: 0; }
  #appearance-description { margin: 16px 0; }
  .appearance-dialog .setting-note { margin-bottom: 14px; }
  .color-swatches { margin-bottom: 18px; }
  .appearance-dialog footer { padding-top: 12px; }
}
@media (max-width: 360px) {
  .rail .compose-button { width: 40px; min-width: 40px; }
  .mailbox, .stop-control { width: 34px; min-width: 34px; }
}
