:root {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #242424;
  background: #f8f8f8;
  --surface: #ffffff;
  --ink: #242424;
  --muted: #636363;
  --line: #e4e4e4;
  --accent: #474747;
  --accent-dark: #333333;
  --tint: #efefef;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(ellipse at 50% 4%, #efefef 0%, transparent 540px);
  font-size: 14px;
  line-height: 1.5;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .65; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.skip { position: absolute; top: -80px; left: 16px; }
.skip:focus { top: 8px; z-index: 10; padding: 8px 12px; background: var(--surface); }
.app { width: min(100% - 48px, 1060px); margin: auto; padding-bottom: 48px; }
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 9px; color: var(--ink); font-size: 21px; font-weight: 750; letter-spacing: -.7px; }
.brand:hover { text-decoration: none; }
.brand img { border-radius: 9px; object-fit: cover; }
.brand span, .team-link { color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: 0; }
.brand span { border-left: 1px solid #d8d8d8; padding-left: 10px; margin-left: 2px; }
.team-link { padding: 8px 0 8px 8px; }
.team-link span { margin-left: 3px; }
main { margin-top: 32px; }
.entry {
  width: min(100%, 470px);
  margin: clamp(38px, 10vh, 100px) auto 0;
  padding: 30px 32px 22px;
  background: var(--surface);
  border: 1px solid #dedede;
  border-radius: 22px;
  box-shadow: 0 24px 64px #34245612, 0 2px 6px #34245608;
}
.entry-heading { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; margin-bottom: 24px; }
.entry-mark, .account-mark {
  display: grid;
  place-items: center;
  flex: none;
  color: var(--accent);
  background: linear-gradient(145deg, #f6f6f6, #e6e6e6);
  border: 1px solid #e4e4e4;
}
.entry-mark { width: 48px; height: 48px; border-radius: 14px; }
.entry h1 { margin: 0; font-size: 30px; line-height: 1.13; font-weight: 720; letter-spacing: -1.1px; }
#mail-form { display: grid; gap: 16px; }
.field { min-width: 0; }
.field label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 650; }
.input-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  padding-right: 6px;
  border: 1px solid #d8d8d8;
  border-radius: 11px;
  background: #f9f9f9;
}
.input-wrap:focus-within { border-color: #767676; box-shadow: 0 0 0 3px #e9e9e9; background: #ffffff; }
.input-wrap:has([aria-invalid="true"]) { border-color: #747474; }
.input-wrap input {
  flex: 1;
  min-width: 0;
  width: 100%;
  padding: 11px 12px;
  min-height: 46px;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 16px;
}
.input-wrap input::placeholder { color: #767676; }
.field-action, .subtle, .icon-button, .watch, .filters button {
  border: 1px solid transparent;
  background: transparent;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.field-action { padding: 6px 9px; background: #ececec; color: #4e4e4e; font-size: 12px; }
.field-action:hover, .subtle:hover, .icon-button:hover:not(:disabled) { background: var(--tint); color: var(--accent-dark); }
.hint, .provider { margin: 7px 0 0; font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.provider a { font-weight: 650; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; }
.primary {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex: 1;
  min-height: 44px;
  padding: 8px 13px;
  border: 1px solid var(--accent);
  border-radius: 10px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 650;
  text-align: left;
}
.primary:hover:not(:disabled) { background: var(--accent-dark); }
.primary:hover { text-decoration: none; }
.button-arrow { font-size: 18px; line-height: 1; }
.privacy { margin: 18px 0 0; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }

.account-bar, .inbox { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 3px 12px #34245606; }
.account-bar { display: flex; align-items: center; gap: 12px; padding: 14px; }
.account-mark { width: 40px; height: 40px; border-radius: 11px; font-size: 18px; font-weight: 650; }
.account-info { flex: 1; min-width: 0; }
.account-address { font-size: 14px; font-weight: 700; overflow-wrap: anywhere; }
.account-service { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; font-size: 12px; color: var(--muted); }
.dot, .new-dot, .watch-dot { width: 6px; height: 6px; flex: none; border-radius: 50%; background: #6d6d6d; }
.account-actions { display: flex; align-items: center; gap: 6px; }
.subtle { color: var(--muted); padding: 7px 9px; }
.icon-button { min-width: 36px; min-height: 36px; font-size: 20px; line-height: 1; }
.watch { display: flex; align-items: center; gap: 7px; padding: 7px 10px; border-color: var(--line); }
.watch:hover, .watch[aria-pressed="true"] { background: var(--tint); color: var(--accent-dark); border-color: #dcdcdc; }
.watch-dot { background: transparent; border: 1px solid currentColor; }
.watch[aria-pressed="true"] .watch-dot, .new-dot { background: var(--accent); }
.inbox { margin-top: 17px; }
.inbox-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 16px 18px; }
.inbox-caption { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; }
.inbox-caption h2 { margin: 0; font-size: 22px; letter-spacing: -.6px; line-height: 1.2; }
#mail-updated, .mail-date { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.filters { display: inline-flex; gap: 3px; padding: 3px; border-radius: 10px; background: #f3f3f3; }
.filters button { padding: 4px 9px; color: var(--muted); }
.filters button:hover { color: var(--accent-dark); }
.filters button[aria-pressed="true"] { background: #ffffff; border-color: var(--line); color: var(--ink); }
.message-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 144px;
  align-items: center;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding: 0 18px;
}
.message-row:last-child { border-radius: 0 0 16px 16px; }
.message-row:hover { background: #fafafa; }
.message-row.selected { background: #f1f1f1; box-shadow: inset 3px 0 var(--accent); }
.message-open {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(85px, 145px) 92px;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 11px 0;
}
.message-summary { min-width: 0; display: grid; gap: 1px; }
.mail-sender { display: flex; align-items: center; gap: 7px; font-weight: 650; min-width: 0; }
.sender-name, .mail-subject, .message-type { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mail-subject { color: var(--muted); font-size: 12px; }
.message-type {
  justify-self: start;
  max-width: 100%;
  border: 1px solid #e3e3e3;
  border-radius: 6px;
  padding: 2px 7px;
  background: #f4f4f4;
  color: #565656;
  font-size: 11px;
  font-weight: 650;
}
.row-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 5px; min-width: 0; }
.row-actions:empty { display: none; }
.code, .invite-link, .invite-copy {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 4px 8px;
  border: 1px solid #dfdfdf;
  border-radius: 8px;
  background: #f5f5f5;
  color: var(--accent-dark);
  white-space: nowrap;
}
.code { font: 650 13px ui-monospace, Consolas, monospace; user-select: text; }
.copy-symbol { font: 13px Arial, sans-serif; }
.invite-link { font-size: 12px; font-weight: 650; }
.code:hover, .invite-copy:hover, .invite-link:hover { background: #ebebeb; text-decoration: none; }
.empty-result { padding: 36px 18px; border-top: 1px solid var(--line); text-align: center; color: var(--muted); }
.mail-detail { padding: 16px 18px 20px; background: #f6f6f6; border-top: 1px solid var(--line); }
.mail-detail:last-child { border-radius: 0 0 16px 16px; }
.detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
.detail-subject { margin: 0 0 3px; font-size: 16px; overflow-wrap: anywhere; }
.detail-meta { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.detail-tools, .extra-invites { display: flex; flex-wrap: wrap; gap: 6px; }
.extra-invites { margin-bottom: 12px; }
.letter-shell { max-width: 760px; margin: auto; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #ffffff; }
.mail-html { display: block; width: 100%; height: clamp(350px, 58vh, 530px); border: 0; background: #ffffff; }
.mail-text { padding: 18px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.7; }
.mail-text a { text-decoration: underline; }
.notice { margin: 12px 0; padding: 9px 12px; border-radius: 9px; background: var(--tint); color: #444444; font-size: 13px; }
#mail-entry-notice { margin: 0; }
.notice.error { background: #f3f3f3; color: #474747; }
.wait-status { margin: 0; padding: 0 18px 12px; color: var(--accent-dark); font-size: 13px; }
.toast { position: fixed; bottom: 24px; left: 50%; z-index: 10; transform: translateX(-50%); border-radius: 9px; padding: 9px 14px; background: #2a2a2a; color: #ffffff; box-shadow: 0 6px 24px #30263f2a; }
.spinner { width: 14px; height: 14px; border: 2px solid #fff6; border-top-color: #ffffff; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }
@media (max-width: 690px) {
  .app { width: calc(100% - 28px); }
  .header { min-height: 62px; }
  main { margin-top: 18px; }
  .entry { padding: 24px 20px 18px; }
  .entry h1 { font-size: 27px; }
  .account-bar { flex-wrap: wrap; gap: 8px; padding: 11px; }
  .account-info { flex-basis: calc(100% - 56px); }
  .account-actions { justify-content: flex-end; width: 100%; }
  .inbox-head { padding: 12px; }
  .message-row { display: flex; padding: 0 10px; gap: 7px; }
  .message-open { grid-template-columns: minmax(0, 1fr); gap: 3px; }
  .row-actions { flex: 0 1 auto; max-width: 43%; }
  .mail-detail { padding: 12px 10px; }
  .detail-head { display: grid; }
  .mail-html { height: 350px; }
}

.brand img { object-fit: contain; border-radius: 0; }

body { background: none; }
.brand img { background: #e4e4e4; border-radius: 5px; }

.sender-mark { width: 16px; height: 16px; border-radius: 4px; object-fit: contain; flex: none; }

.message-type, .message-type[data-kind] { background: transparent; border: 0; padding-left: 0; color: var(--muted); }
.message-kind-icon { margin-right: 5px; font-size: 14px; }

.message-kind-icon { width: 14px; height: 14px; vertical-align: middle; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.message-type[data-kind], .message-kind-icon { color: var(--muted); }

#mail-entry-notice.notice, #mail-entry-notice.notice.error { background: transparent; border: 0; padding: 0; margin: 6px 0 0; color: var(--muted); font-size: 12px; }

/* Compact layout shared by the sign-in and inbox screens. */
:root {
  --canvas: #fafafa;
  --panel: #f5f5f5;
  --on-accent: #fff;
  background: var(--canvas);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #111;
  --surface: #171717;
  --panel: #1d1d1d;
  --ink: #eee;
  --muted: #aaa;
  --line: #343434;
  --accent: #eee;
  --accent-dark: #fff;
  --on-accent: #161616;
  --tint: #262626;
}
body { background: var(--canvas); color: var(--ink); }
.app { width: auto; }
.header {
  min-height: 52px;
  padding: 0 26px;
  background: var(--surface);
}
.brand { font-size: 17px; }
.brand img { width: 29px; height: 29px; border-radius: 5px; background: #e4e4e4; }
.header-actions { display: flex; align-items: center; gap: 12px; }
#mail-theme { display: grid; place-items: center; min-width: 32px; min-height: 32px; border-color: var(--line); }
#mail-theme[aria-pressed="true"] { background: var(--tint); }
main { margin: 20px 26px 0; }
.entry {
  width: min(100%, 402px);
  margin: clamp(48px, 12vh, 110px) auto 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}
.entry h1 { font-size: 26px; letter-spacing: -.65px; }
.entry-heading { margin-bottom: 16px; }
#mail-form { gap: 10px; }
.input-wrap { background: var(--surface); border-color: var(--line); border-radius: 6px; padding-left: 10px; }
.input-wrap:focus-within { background: var(--surface); border-color: var(--muted); box-shadow: none; }
.input-wrap input { min-height: 42px; padding: 8px 5px; }
.input-icon { color: var(--muted); flex: none; }
.field-action { background: var(--tint); color: var(--ink); }
.form-actions { justify-content: flex-start; }
#mail-clear { order: 1; }
.primary { flex: none; min-height: 35px; padding: 6px 11px; border-radius: 6px; color: var(--on-accent); }
.privacy { padding-top: 0; border: 0; }
.account-bar { padding: 0 0 8px; background: transparent; border: 0; box-shadow: none; }
.account-mark { width: 32px; height: 32px; border-color: var(--line); background: var(--tint); border-radius: 6px; }
.inbox { margin-top: 4px; border-radius: 8px; box-shadow: none; }
.inbox-head { padding: 10px 12px; }
.inbox-caption h2 { font-size: 19px; }
.inbox-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 7px 12px; border-block: 1px solid var(--line); background: var(--panel); }
#mail-search { width: min(100%, 192px); min-height: 31px; padding: 3px 8px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); }
.filters { background: transparent; padding: 0; }
.filters button[aria-pressed="true"] { background: var(--tint); }
.message-columns, .message-row {
  --message-columns: minmax(95px, 1fr) minmax(130px, 2.25fr) minmax(120px, 1fr) 92px;
  grid-template-columns: minmax(0, 1fr) 132px;
  gap: 10px;
  padding-inline: 12px;
}
.message-columns {
  display: grid;
  grid-template-columns: var(--message-columns) 132px;
  align-items: center;
  padding-block: 6px;
  background: var(--panel);
  color: var(--muted);
  font-size: 12px;
}
.message-columns span:last-child { text-align: right; }
.message-open { grid-template-columns: var(--message-columns); gap: 10px; min-height: 42px; padding: 5px 0; }
.message-row:hover, .message-row.selected { background: var(--tint); }
.mail-subject { font-size: 13px; }
.mail-detail { background: var(--panel); }
.mail-text { background: #fff; color: #252525; }
:root[data-theme="dark"] :is(.watch,.code,.invite-link,.invite-copy,.message-type:not([data-kind])) {
  color: var(--ink); background: var(--tint); border-color: var(--line);
}
:root[data-theme="dark"] .message-type[data-kind="code"] { color: #b3d0ff; background: #202d43; border-color: #354d70; }
:root[data-theme="dark"] .message-type[data-kind="invite"] { color: #dbc3fa; background: #352842; border-color: #513c64; }
:root[data-theme="dark"] .notice { color: var(--ink); background: var(--tint); }
:root[data-theme="dark"] .notice.error { color: #ffb6ad; background: #3b2421; }
:root[data-theme="dark"] .spinner { border-color: #1115; border-top-color: #111; }
@media (max-width: 760px) {
  .message-columns { display: none; }
  .message-open { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .message-row { display: flex; padding-inline: 10px; }
}
@media (max-width: 690px) {
  .header { padding-inline: 14px; }
  .header-actions { gap: 7px; }
  main { margin-inline: 14px; }
  .mail-subject { font-size: 12px; }
}

.ui-icon, #mail-theme svg {
  width: 16px;
  height: 16px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#mail-theme { width: 34px; height: 34px; padding: 0; overflow: hidden; }
#mail-theme svg { grid-area: 1 / 1; width: 17px; height: 17px; transition: opacity .2s ease, transform .25s ease; }
#mail-theme .sun { opacity: 1; transform: rotate(0) scale(1); }
#mail-theme .moon { opacity: 0; transform: rotate(-48deg) scale(.55); }
[data-theme="dark"] #mail-theme .sun { opacity: 0; transform: rotate(48deg) scale(.55); }
[data-theme="dark"] #mail-theme .moon { opacity: 1; transform: rotate(0) scale(1); }
#mail-open { min-width: 90px; justify-content: center; gap: 7px; }
#mail-open[aria-busy="true"] .login-icon { opacity: .65; }
#switch-mail { display: inline-flex; align-items: center; gap: 6px; }
#mail-refresh { display: grid; place-items: center; border-color: var(--line); }
#mail-refresh[aria-busy="true"] svg { animation: refresh-turn .42s ease-out both; }
.watch { min-width: 116px; transition: background-color .18s, border-color .18s, color .18s; }
.wait-clock { width: 15px; height: 15px; }
.wait-hand { transform-origin: 12px 12px; }
.watch[aria-pressed="true"] .wait-hand { animation: refresh-turn 1.45s linear infinite; }
.message-columns, .message-row {
  --message-columns: 18px minmax(90px, 1fr) minmax(120px, 2.25fr) minmax(110px, 1fr) 92px;
}
.row-chevron { width: 14px; height: 14px; color: var(--muted); transition: transform .17s ease; }
.message-open[aria-expanded="true"] .row-chevron { transform: rotate(90deg); }
.mail-detail:not([hidden]) { animation: detail-reveal .18s ease-out; }
.message-row.arriving { animation: message-arrives .43s ease-out; }
.code, .invite-copy, .primary, #mail-theme { transition: background-color .16s, transform .12s; }
.code:active, .invite-copy:active, .primary:active, #mail-theme:active { transform: scale(.97); }
.code.copied, .invite-copy.copied { background: var(--tint); border-color: var(--muted); }
@keyframes refresh-turn { to { transform: rotate(360deg); } }
@keyframes detail-reveal { from { opacity: .45; transform: translateY(-3px); } }
@keyframes message-arrives { from { opacity: .4; transform: translateY(-5px); background: var(--tint); } }
@media (max-width: 760px) {
  .message-open { grid-template-columns: 15px minmax(0, 1fr); column-gap: 5px; }
  .row-chevron { grid-row: span 4; }
  .row-actions { max-width: 43%; }
}
@media (prefers-reduced-motion: reduce) {
  #mail-theme svg, .row-chevron, .watch, .code, .invite-copy, .primary, #mail-theme { transition: none; }
  #mail-refresh[aria-busy="true"] svg, .watch[aria-pressed="true"] .wait-hand,
  .mail-detail:not([hidden]), .message-row.arriving { animation: none; }
  .code:active, .invite-copy:active, .primary:active, #mail-theme:active { transform: none; }
}
.inbox-search {
  display: flex;
  align-items: center;
  gap: 6px;
  width: min(100%, 205px);
  padding-inline: 7px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
  color: var(--muted);
}
.inbox-search:focus-within { border-color: var(--muted); }
#mail-search { min-width: 0; padding-inline: 0; border: 0; outline: 0; color: var(--ink); }
.inbox-search kbd { font-size: 11px; line-height: 1.2; padding: 1px 4px; border: 1px solid var(--line); border-radius: 4px; }
@media (hover: none) { .inbox-search kbd { display: none; } }
@media (prefers-reduced-motion: no-preference) {
  #password-label:not([hidden]) { animation: detail-reveal .16s ease-out; }
}
