/* Webmail layout */
body.mail { height: 100vh; overflow: hidden; }
.wm { display: flex; height: 100vh; }
.wm-side { flex: 0 0 256px; background: var(--navy); color: #C9D3DF; padding: 20px 14px; display: flex; flex-direction: column; gap: 18px; overflow-y: auto; }
.wm-side .brand { padding: 0 8px; color: #fff; }
.wm-side .compose-btn { width: 100%; min-height: 46px; }
.folders { display: flex; flex-direction: column; gap: 2px; }
.folder { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: 10px; color: #C9D3DF; background: transparent; border: 0; font: 500 14px var(--font); cursor: pointer; text-align: left; width: 100%; }
.folder:hover { background: rgba(255,255,255,.06); color: #fff; }
.folder.active { background: rgba(255,255,255,.10); color: #fff; }
.folder svg { width: 18px; height: 18px; flex: 0 0 auto; }
.folder .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder .count { font-size: 12px; font-weight: 600; background: var(--teal); color: var(--teal-ink); padding: 2px 8px; border-radius: 999px; }
.side-label { padding: 0 12px; font-size: 12px; font-weight: 600; letter-spacing: .8px; color: #9FB0C3; }
.storage { margin-top: auto; padding: 14px; border-radius: 12px; background: rgba(255,255,255,.06); display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.storage .bar { height: 6px; border-radius: 99px; background: rgba(255,255,255,.14); overflow: hidden; }
.storage .bar div { height: 6px; background: var(--teal); border-radius: 99px; }
.side-user { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; }
.side-user .who { flex: 1; min-width: 0; }
.side-user .who div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user .who .e { font-size: 12px; color: #9FB0C3; }
.side-user button { color: #C9D3DF; }
.side-user button:hover { background: rgba(255,255,255,.08); color: #fff; }

.wm-list { flex: 0 0 420px; max-width: 440px; background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; min-width: 0; }
.wm-list-head { padding: 20px 20px 12px; display: flex; flex-direction: column; gap: 12px; }
.wm-list-head h1 { font-size: 26px; }
.search { display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 0 14px; border-radius: 12px; background: var(--chip); color: var(--muted); }
.search input { flex: 1; border: 0; background: transparent; font: 400 14px var(--font); color: var(--ink); outline: none; min-width: 0; }
.search svg { width: 18px; height: 18px; }
.bulkbar { display: flex; align-items: center; gap: 6px; padding: 0 12px 8px 20px; min-height: 44px; }
.msgs { flex: 1; overflow-y: auto; }
.msg { display: flex; gap: 12px; padding: 14px 20px; border-top: 1px solid var(--line-2); cursor: pointer; background: #fff; position: relative; }
.msg:hover { background: #FAFBFC; }
.msg.active { background: var(--brand-tint); box-shadow: inset 3px 0 0 var(--brand); }
.msg.unread .who, .msg.unread .subj { font-weight: 600; }
.msg .av { flex: 0 0 40px; width: 40px; height: 40px; border-radius: 99px; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 13px; }
.msg .body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.msg .top { display: flex; align-items: baseline; gap: 8px; }
.msg .who { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.msg .time { font-size: 12px; color: var(--muted); white-space: nowrap; }
.msg .subj, .msg .prev { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg .subj { font-size: 13.5px; }
.msg .prev { font-size: 13px; color: var(--muted); }
.msg .icons { display: flex; gap: 6px; align-items: center; color: var(--muted); }
.msg .icons svg { width: 14px; height: 14px; }
.msg .icons .star { color: #DC6803; }
.msg input[type=checkbox] { position: absolute; left: 6px; top: 50%; transform: translateY(-50%); opacity: 0; }
.msg:hover input[type=checkbox], .msg input[type=checkbox]:checked { opacity: 1; }
.pager { display: flex; align-items: center; justify-content: space-between; padding: 10px 20px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }

.wm-read { flex: 1 1 auto; min-width: 0; background: var(--bg); display: flex; flex-direction: column; overflow: hidden; }
.read-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 20px 32px 12px; }
.read-scroll { flex: 1; overflow-y: auto; padding: 0 32px 32px; display: flex; flex-direction: column; gap: 16px; }
.article { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 28px 32px; display: flex; flex-direction: column; gap: 20px; }
.article h2 { font-size: 26px; line-height: 1.25; letter-spacing: -0.5px; }
.sender { display: flex; align-items: center; gap: 14px; }
.sender .av { width: 46px; height: 46px; border-radius: 99px; display: flex; align-items: center; justify-content: center; font-weight: 600; flex: 0 0 auto; }
.sender .meta { flex: 1; min-width: 0; }
.sender .meta .n { font-weight: 600; font-size: 15px; overflow-wrap: anywhere; }
.sender .meta .n span { font-weight: 400; color: var(--muted); font-size: 13px; }
.sender .meta .d { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.mail-frame { width: 100%; border: 0; min-height: 120px; background: #fff; display: block; }
.mail-text { white-space: pre-wrap; font-size: 15px; line-height: 1.6; color: var(--ink-2); overflow-wrap: anywhere; margin: 0; font-family: var(--font); }
.atts { display: flex; flex-wrap: wrap; gap: 12px; }
.att { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; background: #F9FAFB; text-decoration: none; color: var(--ink); max-width: 280px; }
.att .ext { width: 40px; height: 40px; border-radius: 10px; background: var(--brand-soft); color: var(--brand-dark); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex: 0 0 auto; text-transform: uppercase; }
.att .fn { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quick-reply { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 16px 20px; display: flex; flex-direction: column; gap: 12px; }
.quick-reply textarea { border: 0; resize: vertical; min-height: 64px; font: 400 15px var(--font); color: var(--ink); outline: none; }
.read-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: var(--muted); }
.read-empty svg { width: 48px; height: 48px; stroke: #98A2B3; }
.back-btn { display: none; }

/* compose */
.compose { position: fixed; right: 24px; bottom: 0; width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 40px); background: #fff; border: 1px solid var(--line); border-radius: 16px 16px 0 0; box-shadow: 0 20px 60px rgba(13,27,42,.25); display: flex; flex-direction: column; z-index: 40; }
.compose-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 12px 20px; background: var(--navy); color: #fff; border-radius: 16px 16px 0 0; }
.compose-head h3 { flex: 1; color: #fff; font-size: 15px; }
.compose-head button { color: #fff; }
.compose-head button:hover { background: rgba(255,255,255,.1); color: #fff; }
.compose-body { padding: 4px 20px 12px; display: flex; flex-direction: column; overflow-y: auto; }
.cline { display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--line-2); min-height: 46px; }
.cline label { font-size: 13px; color: var(--muted); width: 56px; flex: 0 0 auto; }
.cline input { flex: 1; border: 0; outline: none; font: 400 14px var(--font); color: var(--ink); min-width: 0; min-height: 44px; }
.cline .link { background: none; border: 0; color: var(--muted); font: 500 13px var(--font); cursor: pointer; min-height: 44px; padding: 0 6px; }
.compose textarea.cbody { border: 0; outline: none; resize: none; min-height: 220px; font: 400 15px/1.55 var(--font); color: var(--ink); padding: 14px 0; }
.quoted { border-left: 3px solid var(--line); padding: 4px 0 4px 12px; color: var(--muted); font-size: 13px; max-height: 160px; overflow: auto; white-space: pre-wrap; }
.compose-foot { display: flex; align-items: center; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--line-2); flex-wrap: wrap; }
.file-chips { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 8px; }
.file-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--chip); border-radius: 8px; padding: 4px 4px 4px 10px; font-size: 13px; }
.file-chip button { border: 0; background: none; cursor: pointer; width: 28px; height: 28px; color: var(--muted); border-radius: 6px; }

/* login */
.mail-login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--navy); }
.mail-login .card { width: 100%; max-width: 420px; padding: 32px; display: flex; flex-direction: column; gap: 18px; }

/* mobile */
.mobile-top { display: none; }
@media (max-width: 1100px) {
  .wm-list { flex-basis: 360px; }
}
@media (max-width: 860px) {
  body.mail { overflow: auto; height: auto; }
  .wm { height: auto; min-height: 100vh; flex-direction: column; }
  .wm-side { position: fixed; inset: 0 auto 0 0; width: 280px; z-index: 45; transform: translateX(-100%); transition: transform .2s; }
  .wm.menu-open .wm-side { transform: none; box-shadow: 0 0 0 100vmax rgba(13,27,42,.45); }
  .mobile-top { display: flex; align-items: center; gap: 4px; background: var(--navy); color: #fff; padding: 12px; position: sticky; top: 0; z-index: 30; }
  .mobile-top button { color: #fff; } .mobile-top button:hover { background: rgba(255,255,255,.08); color: #fff; }
  .mobile-top .t { flex: 1; font-family: var(--display); font-weight: 600; font-size: 20px; }
  .wm-list { max-width: none; flex: 1 1 auto; border-right: 0; }
  .wm-list-head h1 { display: none; }
  .wm-read { display: none; }
  .wm.reading .wm-list { display: none; }
  .wm.reading .wm-read { display: flex; }
  .wm.reading .mobile-top { display: none; }
  .read-toolbar { padding: 12px 12px 8px; position: sticky; top: 0; background: var(--bg); z-index: 5; }
  .read-scroll { padding: 0 12px 24px; overflow: visible; }
  .article { padding: 20px; }
  .article h2 { font-size: 22px; }
  .back-btn { display: inline-flex; }
  .compose { right: 0; left: 0; width: auto; top: 0; max-height: none; border-radius: 0; }
  .compose-head { border-radius: 0; }
  .fab { position: fixed; right: 20px; bottom: 24px; width: 60px; height: 60px; border-radius: 20px; z-index: 20; box-shadow: 0 8px 20px rgba(11,122,107,.35); }
}
@media (min-width: 861px) { .fab { display: none; } }
.wm.reading .fab { display: none; }
