/* 邮件（方案/06-界面设计规范.md）。彩色只用红（新的）和金（搜到的字）。 */

body.has-dock main {
  padding-bottom: calc(108px + env(safe-area-inset-bottom));
}

.one-line {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* 标题本身就是换信箱的按钮 */
.list-title {
  display: flex;
  align-items: center;
  min-width: 0;
}

.folder-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 44px;
  max-width: 100%;
  padding: 0;
  border: 0;
  background: none;
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  cursor: pointer;
}

.folder-btn .icon {
  width: 22px;
  height: 22px;
  margin-top: 4px;
  color: var(--muted);
}

/* 搜索框常驻顶上 */
.find {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  gap: 8px;
  margin: 12px -20px 0;
  padding: 8px 20px;
  background: var(--bg);
}

.find-box {
  position: relative;
  flex: 1;
  min-width: 0;
}

.find-box .icon {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 20px;
  height: 20px;
  color: var(--muted);
  pointer-events: none;
}

.find-box .search {
  padding-left: 40px;
  -webkit-appearance: none;
  appearance: none;
}

.filter-btn {
  flex: none;
  padding: 0 14px;
  background: var(--paper);
  white-space: nowrap;
}

.filter-btn.on {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.filter-sum {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.link-btn {
  min-height: 32px;
  padding: 0 4px;
  border: 0;
  background: none;
  color: var(--ink);
  font-size: 13px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

/* 分段标题 */
.mail-list .section-title {
  align-items: center;
  margin: 24px 0 10px;
  color: var(--ink);
  font-weight: 600;
}

.mail-list .section-title .sub {
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
}

.month-title {
  scroll-margin-top: 72px;
  margin: 20px 0 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

/* 信的一行 */
.mail-list .rows li {
  display: flex;
  align-items: center;
}

.mrow {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 12px;
  min-width: 0;
  min-height: 76px;
  padding: 12px 14px;
}

.mrow:active {
  background: var(--soft);
}

.mrow-main {
  display: grid;
  flex: 1;
  gap: 2px;
  min-width: 0;
}

.mrow-top {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.mrow-name {
  min-width: 2.2em;
  overflow: hidden;
  font-size: 16px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.mrow-n {
  flex: none;
  color: var(--muted);
  font-size: 13px;
}

.mrow-time {
  flex: none;
  margin-left: auto;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.mrow-top .clip {
  width: 16px;
  height: 16px;
  color: var(--muted);
}

.mrow-subj {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  font-size: 15px;
}

.mrow-subj-text {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.mrow-prev {
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.mrow.unread .mrow-name,
.mrow.unread .mrow-subj-text {
  font-weight: 650;
}

.mrow .dot {
  flex: none;
}

.row-act {
  flex: none;
  margin-right: 12px;
}

.left-days {
  color: var(--red);
}

mark {
  border-radius: 3px;
  background: var(--gold-soft);
  color: inherit;
}

/* 头像：好友是卡通形象，别人是首字，陌生人是灰色剪影，官方是 y */
.avatar.sm {
  width: 32px;
  height: 32px;
}

.avatar.xs {
  width: 28px;
  height: 28px;
}

.avatar.initial,
.avatar.official,
.avatar.stranger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.avatar.initial {
  background: var(--soft);
  font-size: 17px;
  font-weight: 600;
}

.avatar.official {
  background: var(--ink);
  color: #fff;
  font-size: 19px;
  font-weight: 700;
}

.avatar.stranger svg {
  width: 72%;
  height: 72%;
  margin-top: 28%;
  fill: #fffcf7;
  stroke: none;
}

.avatar.sm.initial,
.avatar.xs.initial,
.avatar.sm.official,
.avatar.xs.official {
  font-size: 14px;
}

.tag.ink {
  background: var(--ink);
  color: #fff;
}

.tag .icon {
  width: 12px;
  height: 12px;
  stroke-width: 2;
}

.mrow-top .tag {
  flex: none;
}

/* 年、月卡片 */
.cards.years,
.cards.months {
  margin-bottom: 4px;
}

.ycard {
  display: grid;
  align-content: space-between;
  gap: 10px;
  min-height: 104px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--paper);
  text-align: left;
  cursor: pointer;
  transition: transform 150ms ease;
}

.ycard:active {
  transform: scale(0.97);
}

.ystack {
  display: flex;
  padding-left: 8px;
}

.ystack > * {
  margin-left: -8px;
  box-shadow: 0 0 0 2px var(--paper);
}

.yname {
  display: block;
  font-size: 17px;
  font-weight: 600;
}

.ycount {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

.cards.months {
  margin-top: 16px;
}

.cards.months .ycard {
  min-height: 60px;
  align-content: center;
  gap: 0;
}

/* 空的时候 */
.empty.face {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 16px;
}

.empty.face .avatar {
  width: 64px;
  height: 64px;
}

/* 一串信：像一叠信纸 */
.subject {
  margin-bottom: 8px;
  overflow-wrap: anywhere;
}

.thread-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 16px;
}

.letters {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.letter {
  position: relative;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--paper);
  box-shadow: 0 6px 18px rgba(26, 24, 20, 0.05);
}

.letter.open {
  padding: 16px;
}

.letter.mine {
  background: #fbf6ec;
}

.letter.folded,
.pile {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 60px;
  padding: 10px 14px;
  text-align: left;
  cursor: pointer;
  transition: transform 150ms ease;
}

.letter.folded:active,
.pile:active {
  transform: scale(0.985);
}

.folded-main {
  display: grid;
  flex: 1;
  min-width: 0;
}

.folded-main b {
  font-size: 15px;
  font-weight: 600;
}

.folded-main span {
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.folded .when {
  flex: none;
  align-self: flex-start;
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

/* 更早的几封叠成一摞 */
.pile {
  justify-content: center;
  margin-bottom: 8px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--paper);
  color: var(--muted);
  font-size: 15px;
  box-shadow:
    0 4px 0 -1px var(--paper),
    0 4px 0 0 var(--line),
    0 8px 0 -2px var(--paper),
    0 8px 0 -1px var(--line);
}

.letter-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.letter-who {
  display: grid;
  flex: 1;
  gap: 2px;
  min-width: 0;
}

.letter-who b {
  font-size: 17px;
  font-weight: 600;
}

.letter-who span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

/* 头像做成邮票的样子 */
.stamp {
  flex: none;
  padding: 3px;
  border: 1.5px dashed #d2c8b6;
  border-radius: 8px;
  background: #fff;
  transform: rotate(3deg);
}

.stamp .avatar {
  display: flex;
  width: 46px;
  height: 46px;
  border-radius: 5px;
}

.letter-body {
  margin: 14px 0 0;
  font-size: 16px;
  line-height: 28px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background-image: repeating-linear-gradient(transparent 0 27px, #eee6d7 27px 28px);
}

.letter .atts {
  margin-top: 14px;
}

.atts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.atts:empty {
  display: none;
}

.att {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  font-size: 14px;
  cursor: pointer;
}

.att .icon {
  width: 20px;
  height: 20px;
  color: var(--muted);
}

.att-name {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.att-kind {
  flex: none;
  color: var(--muted);
  font-size: 12px;
}

.att .x {
  flex: none;
  margin-left: 2px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
}

.from-me-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
}

/* 底部：拇指够得着的地方 */
.dock {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 20;
  display: flex;
  gap: 8px;
  width: min(100%, 420px);
  padding: 20px 20px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 72%, rgba(243, 239, 230, 0));
  transform: translateX(-50%);
}

.dock:empty {
  display: none;
}

.dock .btn {
  flex: none;
  min-height: 52px;
  padding: 0 14px;
}

.dock .btn.primary {
  flex: 1;
  width: auto;
  min-width: 0;
}

.dock .btn .icon {
  width: 20px;
  height: 20px;
}

.dock .btn.icon-only {
  width: 52px;
  padding: 0;
}

/* 写信 */
.write {
  display: grid;
  gap: 18px;
}

.field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.field-name {
  color: var(--muted);
  font-size: 13px;
}

.from-line {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 8px 14px 8px 10px;
  border-radius: 14px;
  background: var(--soft);
}

.from-line strong {
  min-width: 0;
  font-size: 16px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.field-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.to-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-height: 52px;
  padding: 6px 8px;
  border: 1px solid #d9d1c3;
  border-radius: 14px;
  background: var(--paper);
}

.to-box:focus-within,
.w-input:focus {
  border-color: var(--ink);
  outline: none;
}

.to-chips {
  display: contents;
}

.to-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  height: 38px;
  padding: 0 10px 0 4px;
  border: 0;
  border-radius: 999px;
  background: var(--soft);
  font-size: 15px;
  cursor: pointer;
}

.to-chip span {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.to-chip .x {
  flex: none;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
}

.to-input {
  flex: 1;
  min-width: 120px;
  height: 40px;
  padding: 0 6px;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 16px;
  outline: none;
}

.suggest {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.suggest:empty {
  display: none;
}

.pal {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 44px;
  padding: 0 14px 0 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  font-size: 15px;
  cursor: pointer;
  transition: transform 150ms ease;
}

.pal:active {
  transform: scale(0.97);
}

.w-input {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid #d9d1c3;
  border-radius: 14px;
  background: var(--paper);
  font: inherit;
  font-size: 16px;
}

.w-body {
  min-height: 180px;
  line-height: 1.6;
  resize: vertical;
}

.field .btn.small {
  justify-self: start;
}

.field .btn.small .icon {
  width: 18px;
  height: 18px;
}

.quote {
  padding: 10px 14px;
  border-left: 3px solid var(--line);
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.quote b {
  display: block;
  color: var(--ink);
  font-weight: 500;
}

.quiet-btn {
  justify-self: start;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 15px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

/* 弹层里的选择行 */
.picks {
  margin: 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  overflow: hidden;
}

.picks li + li {
  border-top: 1px solid var(--line);
}

.pick {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 60px;
  padding: 8px 14px;
  border: 0;
  background: transparent;
  font-size: 17px;
  text-align: left;
  cursor: pointer;
}

.pick:active {
  background: var(--soft);
}

.pick.on {
  font-weight: 600;
}

.pick-main {
  display: grid;
  flex: 1;
  min-width: 0;
}

.pick-main small {
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
}

.pick .side {
  flex: none;
  color: var(--muted);
  font-size: 14px;
}

.pick .check {
  flex: none;
  width: 22px;
  height: 22px;
  border: 1.5px solid #cfc6b6;
  border-radius: 50%;
}

.pick.on .check {
  border: 7px solid var(--ink);
}

/* 我的邮箱地址 */
.addr-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}

.addr-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
}

.addr-text {
  font-size: 18px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.addr-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sheet-card .addr-card p {
  font-size: 14px;
}

/* 筛选 */
.f-group {
  display: grid;
  gap: 8px;
}

.f-group h3 {
  margin: 4px 0 0;
  font-size: 15px;
  font-weight: 600;
}

.dates {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.dates input {
  min-width: 0;
  width: 100%;
}

/* 附件只能看：不出现下载按钮，长按不弹存储 */
.preview {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 180px;
  max-height: min(70dvh, 520px);
  overflow: auto;
  border-radius: 14px;
  -webkit-touch-callout: none;
  user-select: none;
}

.preview img {
  display: block;
  width: 100%;
  max-height: min(70dvh, 520px);
  height: auto;
  object-fit: contain;
  pointer-events: none;
  -webkit-user-drag: none;
}

.page {
  display: grid;
  align-content: start;
  gap: 10px;
  width: 70%;
  height: 88%;
  padding: 18px 16px;
  border-radius: 6px 6px 0 0;
  background: #fff;
  box-shadow: 0 4px 16px rgba(26, 24, 20, 0.1);
}

.page b {
  font-size: 14px;
}

.page i {
  display: block;
  height: 6px;
  border-radius: 3px;
  background: var(--soft);
}

.page i:nth-child(3n) {
  width: 70%;
}

.view-only {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(26, 24, 20, 0.55);
  color: #fff;
  font-size: 12px;
}

/* 演示按钮 */
.demo-tools {
  margin-top: 32px;
  color: var(--muted);
  font-size: 14px;
}

.demo-tools summary {
  display: flex;
  align-items: center;
  min-height: 44px;
  cursor: pointer;
}

.demo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.demo-actions .btn {
  color: var(--ink);
}

.sheet {
  z-index: 70;
}

/* 很窄的手机：底部按钮只留字 */
@media (max-width: 359px) {
  .dock .btn:not(.icon-only) .icon {
    display: none;
  }

  .dock .btn {
    padding: 0 12px;
  }
}
