:root {
  color-scheme: light;
  --page: #f8fafd;
  --ink: #202124;
  --muted: #5f6368;
  --line: #dadce0;
  --soft: #e9eef6;
  --row: #ffffff;
  --row-hover: #f2f6fc;
  --nav-on: #d3e3fd;
  --compose: #c2e7ff;
  --compose-hover: #a9d9f7;
  --send: #0b57d0;
  --send-ink: #ffffff;
  --mark: #c5221f;
  --shadow: 0 1px 2px rgba(60, 64, 67, .3), 0 1px 3px 1px rgba(60, 64, 67, .15);
  --shadow-lg: 0 8px 10px 1px rgba(60, 64, 67, .14), 0 3px 14px 2px rgba(60, 64, 67, .12);
  --top: 64px;
  --nav: 256px;
  --radius: 16px;
  --font: "Roboto", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}
[data-theme="dark"] {
  color-scheme: dark;
  --page: #1f1f1f;
  --ink: #e3e3e3;
  --muted: #c4c7c5;
  --line: #3c4043;
  --soft: #2d2e31;
  --row: #1f1f1f;
  --row-hover: #2a2b2d;
  --nav-on: #004a77;
  --compose: #c2e7ff;
  --compose-hover: #a9d9f7;
  --send: #a8c7fa;
  --send-ink: #062e6f;
  --mark: #f28b82;
  --shadow: 0 1px 3px rgba(0, 0, 0, .5);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, .45);
}
[hidden] { display: none !important; }
* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  background: var(--page);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .45; cursor: default; }
svg { width: 20px; height: 20px; fill: currentColor; }

.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
}
.gate-card {
  width: min(400px, 92vw);
  background: var(--row);
  border-radius: 28px;
  padding: 40px 32px;
  box-shadow: var(--shadow);
  text-align: center;
}
.gate-card h1 { margin: 12px 0 8px; font-weight: 400; font-size: 28px; }

.top {
  height: var(--top);
  display: grid;
  grid-template-columns: 48px auto minmax(240px, 720px) 48px 48px;
  align-items: center;
  gap: 8px;
  padding: 0 16px 0 8px;
  position: sticky;
  top: 0;
  z-index: 6;
  background: var(--page);
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 22px;
  font-weight: 400;
  color: var(--muted);
  padding-right: 16px;
}
.logo-mark {
  width: 28px;
  height: 22px;
  border-radius: 3px 3px 5px 5px;
  background: #c5221f;
  position: relative;
  flex: 0 0 auto;
  box-shadow: inset 0 8px 0 -4px #ea4335;
}
.logo-mark::after {
  content: "";
  position: absolute;
  inset: 0;
  border-top: 11px solid transparent;
  border-left: 14px solid #f28b82;
  border-right: 14px solid #ea4335;
  border-bottom: 0;
}
.search {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--soft);
  border-radius: 28px;
  padding: 0 20px;
  height: 48px;
}
.search input {
  flex: 1;
  border: 0;
  background: transparent;
  outline: none;
  font-size: 16px;
}
.icon-btn {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
}
.icon-btn:hover { background: var(--soft); }
.avatar {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: #7b1fa2;
  color: #fff;
  font-weight: 600;
  font-size: 13px;
  justify-self: center;
}

.pop {
  position: fixed;
  top: 60px;
  right: 16px;
  z-index: 8;
  min-width: 220px;
  background: var(--row);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 12px;
  display: grid;
  gap: 10px;
}
.pop label { display: grid; gap: 4px; color: var(--muted); font-size: 12px; }
.pop select {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--page);
  padding: 6px 8px;
}
.account-pop { text-align: center; padding: 20px 16px; }
.account-pop strong { font-size: 16px; }
.account-pop span { display: block; }
.vis-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 13px;
  color: var(--ink);
}
.vis-row input { margin: 0; }

.workspace {
  display: grid;
  grid-template-columns: var(--nav) 1fr;
  min-height: calc(100vh - var(--top));
}
.nav {
  padding: 8px 12px 24px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.compose-btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin: 8px 0 16px 8px;
  height: 56px;
  padding: 0 24px 0 16px;
  border: 0;
  border-radius: 16px;
  background: var(--compose);
  color: #001d35;
  font-weight: 500;
  box-shadow: var(--shadow);
  width: max-content;
}
.compose-btn:hover:not(:disabled) { background: var(--compose-hover); }
.compose-btn svg { width: 24px; height: 24px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 16px;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 0 12px 0 26px;
  height: 32px;
  border-radius: 0 16px 16px 0;
  color: var(--ink);
}
.nav-item.on {
  background: var(--nav-on);
  font-weight: 700;
}
.nav-item:hover:not(.on):not(:disabled) { background: var(--soft); }

.main {
  min-width: 0;
  padding: 0 16px 24px 0;
}
.setup {
  margin: 8px 8px 0 0;
  min-height: calc(100vh - var(--top) - 32px);
  background: var(--row);
  border-radius: 16px 16px 0 0;
  box-shadow: var(--shadow);
  display: grid;
  place-items: center;
  padding: 48px 24px;
}
.setup-card {
  width: min(560px, 100%);
  display: grid;
  gap: 16px;
}
.setup-card h1 {
  margin: 0;
  font-size: 32px;
  font-weight: 400;
  letter-spacing: -.3px;
}
.setup-card h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 400;
}
.setup-card p { margin: 0; color: var(--muted); line-height: 1.45; }
.choice {
  display: grid;
  gap: 8px;
  margin: 8px 0;
}
.choice label {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  cursor: pointer;
}
.choice label.on { border-color: var(--send); background: color-mix(in srgb, var(--nav-on) 55%, transparent); }
.choice .addr { font-size: 16px; font-weight: 500; }
.choice .tag { margin-left: auto; font-size: 12px; color: var(--send); }
.custom-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 36px;
}
.custom-row input {
  flex: 1;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  padding: 8px 0;
  outline: none;
  font-size: 16px;
}
.setup-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 8px; }
.primary, .send-btn {
  border: 0;
  border-radius: 20px;
  background: var(--send);
  color: var(--send-ink);
  padding: 10px 24px;
  font-weight: 500;
}
.text-btn {
  border: 0;
  background: transparent;
  color: var(--send);
  padding: 10px 16px;
  border-radius: 20px;
}
.text-btn:hover { background: var(--soft); }
.banner { color: #c5221f; }

.toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 48px;
  padding: 0 8px;
}
.order-wrap { margin-left: auto; }
.order-wrap select {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--row);
  padding: 6px 12px;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
.rows {
  background: var(--row);
  border-radius: 16px 16px 0 0;
  min-height: calc(100vh - var(--top) - 72px);
  box-shadow: var(--shadow);
}
.row {
  width: 100%;
  display: grid;
  grid-template-columns: 160px 1fr 28px 72px;
  gap: 16px;
  align-items: center;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: var(--row);
  text-align: left;
  padding: 0 16px;
  height: 40px;
}
.row:hover { background: var(--row-hover); box-shadow: inset 1px 0 0 var(--line); }
.row .who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.row .mid { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--muted); }
.row .mid strong { color: var(--ink); font-weight: 500; }
.row .count {
  text-align: center;
  font-size: 11px;
  color: var(--send);
  font-weight: 600;
}
.row .when { text-align: right; font-size: 12px; color: var(--muted); }
.empty {
  padding: 80px 24px;
  text-align: center;
  color: var(--muted);
}
.empty h2 { margin: 16px 0 8px; font-weight: 400; color: var(--ink); }

.thread {
  background: var(--row);
  border-radius: 16px 16px 0 0;
  min-height: calc(100vh - var(--top) - 72px);
  box-shadow: var(--shadow);
  padding: 8px 24px 32px;
}
.thread h1 { font-size: 22px; font-weight: 400; margin: 8px 0 16px; }
.thread .meta { color: var(--muted); margin-bottom: 20px; }
.thread pre {
  white-space: pre-wrap;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.55;
}
.thread-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  margin: 0 0 12px;
  background: var(--page);
}
.thread-item h2 { margin: 0 0 8px; font-size: 16px; font-weight: 500; }
.mail-chain-blocks { margin: 12px 0 0; font-size: 13px; }
.mail-wallet-explorer { color: var(--send); }
.mail-wallet-fill { margin: 10px 0 0; }
.mail-wallet-fill-bar {
  height: 8px;
  border-radius: 99px;
  background: color-mix(in srgb, var(--muted) 22%, var(--page));
  overflow: hidden;
  margin: 6px 0;
}
.mail-wallet-fill-bar span {
  display: block;
  height: 100%;
  background: var(--send);
}
.mail-wallet-modes { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.mail-wallet-modes .on { font-weight: 600; }
.thread-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; align-items: center; }
.notary-capturing .thread-actions { visibility: hidden; }

.composer {
  position: fixed;
  right: 16px;
  bottom: 0;
  width: min(640px, calc(100vw - 32px));
  height: auto;
  max-height: min(780px, calc(100vh - 16px));
  background: var(--row);
  border-radius: 12px 12px 0 0;
  box-shadow: var(--shadow-lg);
  display: grid;
  grid-template-rows: 40px 40px 40px auto auto minmax(200px, 1fr) auto 56px;
  z-index: 9;
  overflow: hidden;
}
.composer header {
  background: #404245;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px 0 16px;
}
.composer header .icon-btn { color: #fff; }
.composer input, .composer textarea {
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  padding: 10px 16px;
  outline: none;
  resize: none;
}
.rich-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  padding: 4px 8px;
  border-bottom: 1px solid var(--line);
}
.rich-tools .text-btn { padding: 6px 10px; }
.link-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
}
.link-row input {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
}
.rich-doc {
  overflow: auto;
  padding: 8px 12px 12px;
  display: grid;
  gap: 10px;
  align-content: start;
}
.rich-block {
  display: grid;
  gap: 6px;
  position: relative;
}
.rich-edit {
  min-height: 56px;
  line-height: 1.5;
  outline: none;
  padding: 6px 8px;
  border-radius: 8px;
}
.rich-edit:focus { background: var(--soft); }
.rich-edit a { color: var(--send); }
.rich-block .text-btn { justify-self: start; }
.mail-body {
  display: grid;
  gap: 12px;
}
.mail-body a, .link-card { color: var(--send); }
.mail-plain { white-space: pre-wrap; line-height: 1.55; }
.link-slot {
  display: block;
  width: 100%;
  margin: 8px 0;
}
.mail-body p .link-slot,
.mail-body p .link-card {
  display: grid;
  margin: 8px 0;
}
.link-card {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  background: var(--page);
}
.link-card img {
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  display: block;
}
.link-card .link-copy { display: grid; gap: 4px; padding: 12px 14px; }
.link-card strong { color: var(--ink); font-weight: 600; }
.link-card em { font-style: normal; color: var(--muted); font-size: 13px; }
.link-card small { color: var(--send); font-size: 12px; word-break: break-all; }
.link-embed-wrap { position: relative; width: 100%; padding-top: 56.25%; }
.link-embed-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.doc-frame {
  width: 100%;
  min-height: 420px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--page);
}
.doc-text {
  max-height: 360px;
  overflow: auto;
  white-space: pre-wrap;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.45;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--page);
}
.embed-file {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: var(--page);
}
.mail-body video, .mail-body audio, .rich-block video, .rich-block audio, .mail-body .att-preview, .rich-block .att-preview {
  width: 100%;
  max-width: 100%;
  border-radius: 8px;
}
.composer footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border-top: 1px solid var(--line);
}
.attach-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-top: 1px solid var(--line);
}
.rec-preview {
  width: 100%;
  max-height: 180px;
  background: #111;
  border-radius: 8px;
  object-fit: cover;
}
.attach-pending, .att-list {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
}
.attach-pending li, .att-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  padding: 4px 0;
}
.att-list { margin-top: 12px; }
.att-list audio, .att-list video, .att-preview {
  width: 100%;
  max-width: 100%;
  margin-top: 8px;
}
.att-panel {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 16px;
  margin: 0 0 16px;
  background: var(--page);
}
.thread-item .att-panel { margin-top: 12px; }
.att-panel h3 {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 600;
}
.att-chip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}
.att-chip:first-of-type { border-top: 0; }
.att-chip strong { flex: 1; min-width: 120px; }
.att-err { color: #c5221f; width: 100%; font-size: 12px; }
.clip { color: var(--send); font-size: 12px; font-weight: 600; }

.muted { color: var(--muted); }
body.nav-collapsed { --nav: 72px; }
body.nav-collapsed .nav-item span,
body.nav-collapsed .compose-btn span { display: none; }
body.nav-collapsed .compose-btn {
  width: 56px;
  padding: 0;
  justify-content: center;
  margin-left: 8px;
}

@media (max-width: 860px) {
  .top { grid-template-columns: 40px 1fr 40px 40px; }
  .search { display: none; }
  .workspace { grid-template-columns: 72px 1fr; }
  .nav-item span, .compose-btn span { display: none; }
  .compose-btn { width: 56px; padding: 0; justify-content: center; }
  .row { grid-template-columns: 1fr 24px 56px; }
  .row .who { display: none; }
}
