/* ============================================================
   Endless — dark, calm, precise
   ============================================================ */
:root {
  --bg: #09090b;
  --bg-1: #0f0f12;
  --bg-2: #141418;
  --bg-3: #1b1b20;
  --bg-hover: rgba(255, 255, 255, 0.035);
  --bg-active: rgba(255, 255, 255, 0.06);
  --line: rgba(255, 255, 255, 0.065);
  --line-2: rgba(255, 255, 255, 0.11);
  --text: #ededf0;
  --text-2: #a3a3ad;
  --text-3: #6c6c77;
  --accent: #9a8cff;
  --accent-strong: #8170ff;
  --accent-soft: rgba(154, 140, 255, 0.12);
  --teal: #5ee6d0;
  --danger: #ff6474;
  --ok: #44d99b;
  --warn: #f5b84a;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow: 0 1px 0 rgba(255,255,255,0.04) inset, 0 20px 50px -12px rgba(0,0,0,0.7), 0 0 0 1px var(--line);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Segoe UI", "Malgun Gothic", "Noto Sans KR", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
  letter-spacing: -0.006em;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
a { color: var(--accent); text-decoration: none; }
::selection { background: rgba(154, 140, 255, 0.35); }
#app { height: 100%; }
.hidden { display: none !important; }

/* 스크롤바 */
* { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.1) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: rgba(255,255,255,0.16); }

/* ============================================================ 공통 요소 */
.icon { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.icon.sm { width: 14px; height: 14px; }
.icon.lg { width: 20px; height: 20px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 14px; border-radius: 9px;
  font-weight: 550; font-size: 13.5px; white-space: nowrap;
  transition: transform .18s var(--ease), background .2s, box-shadow .2s, opacity .2s, color .2s;
  user-select: none;
}
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(180deg, #a294ff, #8170ff);
  color: #0b0a14;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.12) inset, 0 6px 18px -6px rgba(129,112,255,0.6);
}
.btn-primary:hover:not(:disabled) { box-shadow: 0 0 0 1px rgba(255,255,255,0.2) inset, 0 8px 26px -6px rgba(129,112,255,0.8); }
.btn-ghost { color: var(--text-2); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text); }
.btn-outline { box-shadow: 0 0 0 1px var(--line-2) inset; color: var(--text); background: rgba(255,255,255,0.015); }
.btn-outline:hover { background: var(--bg-hover); box-shadow: 0 0 0 1px rgba(255,255,255,0.18) inset; }
.btn-danger { color: var(--danger); box-shadow: 0 0 0 1px rgba(255,100,116,0.3) inset; }
.btn-danger:hover { background: rgba(255,100,116,0.08); }
.btn-block { width: 100%; height: 42px; font-size: 14px; }

.icon-btn {
  width: 32px; height: 32px; border-radius: 8px;
  display: inline-grid; place-items: center; color: var(--text-2);
  transition: background .15s, color .15s, transform .18s var(--ease);
  position: relative;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }
.icon-btn:active { transform: scale(0.92); }
.icon-btn.on { color: var(--warn); }
.icon-btn[data-tip]:hover::after {
  content: attr(data-tip); position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: var(--bg-3); color: var(--text); font-size: 11.5px; padding: 4px 8px; border-radius: 6px;
  white-space: nowrap; box-shadow: var(--shadow); pointer-events: none; z-index: 50;
  animation: tip .15s var(--ease);
}
@keyframes tip { from { opacity: 0; transform: translate(-50%, -3px); } }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12.5px; color: var(--text-2); font-weight: 500; }
.input {
  height: 42px; width: 100%; padding: 0 13px;
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--line-2); border-radius: 10px; outline: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.input::placeholder { color: var(--text-3); }
.input:hover { border-color: rgba(255,255,255,0.16); }
.input:focus { border-color: rgba(154,140,255,0.6); box-shadow: 0 0 0 4px rgba(154,140,255,0.12); background: rgba(255,255,255,0.035); }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap .suffix { position: absolute; right: 13px; color: var(--text-3); font-size: 13px; pointer-events: none; }
.input-wrap .input { padding-right: 130px; }
.hint { font-size: 12px; color: var(--text-3); }
.form-error {
  font-size: 13px; color: var(--danger); background: rgba(255,100,116,0.08);
  border: 1px solid rgba(255,100,116,0.2); padding: 9px 12px; border-radius: 9px;
  animation: shake .4s var(--ease);
}
@keyframes shake { 20%, 60% { transform: translateX(-4px); } 40%, 80% { transform: translateX(4px); } }

.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: spin .7s linear infinite; opacity: .8;
}
@keyframes spin { to { transform: rotate(360deg); } }

.kbd { font-family: var(--mono); font-size: 11px; color: var(--text-3); border: 1px solid var(--line-2); border-radius: 5px; padding: 1px 5px; }

/* ============================================================ 무한대 로고 애니메이션 */
.infinity { width: 36px; height: 18px; overflow: visible; }
.infinity.big { width: 96px; height: 48px; }
.infinity path { fill: none; stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; }
.infinity .inf-track { stroke: rgba(255,255,255,0.08); }
.infinity .inf-run {
  stroke: url(#infGrad); stroke: var(--accent);
  stroke-dasharray: 60 140; stroke-dashoffset: 0;
  animation: inf-run 2.4s linear infinite;
  filter: drop-shadow(0 0 6px rgba(154,140,255,0.7));
}
@keyframes inf-run { to { stroke-dashoffset: -200; } }
.boot { height: 100%; display: grid; place-items: center; animation: fade-in .5s var(--ease); }
@keyframes fade-in { from { opacity: 0; } }

/* ============================================================ 로그인 화면 */
.auth {
  height: 100%; display: grid; place-items: center; position: relative; overflow: hidden; padding: 24px;
}
.auth-bg { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.auth-bg .orb {
  position: absolute; border-radius: 50%; filter: blur(80px); opacity: .55;
  animation: orb 18s var(--ease) infinite alternate;
}
.auth-bg .orb.a { width: 520px; height: 520px; background: radial-gradient(circle, rgba(129,112,255,0.55), transparent 65%); top: -160px; left: -120px; }
.auth-bg .orb.b { width: 460px; height: 460px; background: radial-gradient(circle, rgba(94,230,208,0.35), transparent 65%); bottom: -180px; right: -100px; animation-delay: -6s; animation-duration: 22s; }
.auth-bg .orb.c { width: 300px; height: 300px; background: radial-gradient(circle, rgba(255,120,200,0.18), transparent 65%); top: 40%; left: 55%; animation-delay: -11s; }
@keyframes orb {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(60px, 40px) scale(1.1); }
  100% { transform: translate(-40px, 80px) scale(0.95); }
}
.auth-bg .grid {
  position: absolute; inset: 0;
  background-image: linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, black 20%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 20%, transparent 70%);
}
.auth-card {
  position: relative; width: 100%; max-width: 400px;
  background: rgba(15, 15, 18, 0.72);
  backdrop-filter: blur(24px) saturate(140%); -webkit-backdrop-filter: blur(24px) saturate(140%);
  border-radius: 20px; padding: 36px 32px 28px;
  box-shadow: var(--shadow);
  animation: card-in .8s var(--ease) both;
}
@keyframes card-in { from { opacity: 0; transform: translateY(18px) scale(0.98); filter: blur(6px); } }
.auth-brand { display: flex; flex-direction: column; align-items: center; gap: 14px; margin-bottom: 26px; text-align: center; }
.auth-brand h1 { font-size: 22px; font-weight: 650; letter-spacing: -0.02em; }
.auth-brand p { color: var(--text-2); font-size: 13.5px; }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form > * { animation: rise .6s var(--ease) both; }
.auth-form > *:nth-child(1) { animation-delay: .08s; }
.auth-form > *:nth-child(2) { animation-delay: .13s; }
.auth-form > *:nth-child(3) { animation-delay: .18s; }
.auth-form > *:nth-child(4) { animation-delay: .23s; }
.auth-form > *:nth-child(5) { animation-delay: .28s; }
.auth-form > *:nth-child(6) { animation-delay: .33s; }
.auth-form > *:nth-child(7) { animation-delay: .38s; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
.auth-switch { text-align: center; font-size: 13px; color: var(--text-2); margin-top: 18px; }
.auth-switch button { color: var(--accent); font-weight: 550; }
.auth-switch button:hover { text-decoration: underline; }
.auth-foot {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line);
  font-size: 12px; color: var(--text-3);
}
.auth-foot .icon { color: var(--ok); }
.strength { display: flex; gap: 4px; margin-top: 2px; }
.strength i { flex: 1; height: 3px; border-radius: 3px; background: var(--line-2); transition: background .3s; }
.strength[data-s="1"] i:nth-child(-n+1) { background: var(--danger); }
.strength[data-s="2"] i:nth-child(-n+2) { background: var(--warn); }
.strength[data-s="3"] i:nth-child(-n+3) { background: #b8d94a; }
.strength[data-s="4"] i:nth-child(-n+4) { background: var(--ok); }
.progress-note { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-2); justify-content: center; }

/* ============================================================ 메인 레이아웃 */
.shell {
  height: 100%; display: grid;
  grid-template-columns: 232px minmax(300px, 380px) 1fr;
  animation: fade-in .5s var(--ease);
}
.sidebar {
  background: var(--bg); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 14px 10px; gap: 4px; min-width: 0;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 16px; font-weight: 650; font-size: 15px; letter-spacing: -0.02em; }
.logo-mark { width: 30px; height: 15px; overflow: visible; filter: drop-shadow(0 0 6px rgba(154,140,255,0.45)); }
.compose-btn { margin: 0 2px 14px; height: 38px; }
.nav { display: flex; flex-direction: column; gap: 1px; }
.nav-item {
  position: relative; display: flex; align-items: center; gap: 11px;
  height: 34px; padding: 0 10px; border-radius: 8px;
  color: var(--text-2); font-weight: 500; font-size: 13.5px; text-align: left; width: 100%;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text); }
.nav-item.active { color: var(--text); background: var(--bg-active); }
.nav-item.active::before {
  content: ""; position: absolute; left: -10px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0;
  background: var(--accent); box-shadow: 0 0 12px var(--accent);
  animation: indicator .35s var(--ease);
}
@keyframes indicator { from { transform: scaleY(0); } }
.nav-item .count { margin-left: auto; font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.nav-item .count.unread { color: var(--accent); font-weight: 600; }
.sidebar-spacer { flex: 1; }
.storage-note {
  margin: 0 4px 10px; padding: 12px; border-radius: 12px;
  background: linear-gradient(180deg, rgba(154,140,255,0.07), rgba(94,230,208,0.03));
  box-shadow: 0 0 0 1px rgba(154,140,255,0.12) inset;
  font-size: 12px; color: var(--text-2); line-height: 1.5;
}
.storage-note strong { display: flex; align-items: center; gap: 6px; color: var(--text); font-weight: 600; font-size: 12.5px; margin-bottom: 3px; }
.storage-note .icon { color: var(--ok); }
.me {
  display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; width: 100%; text-align: left;
  transition: background .15s;
}
.me:hover { background: var(--bg-hover); }
.me-info { min-width: 0; flex: 1; }
.me-name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-addr { font-size: 11.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-weight: 650; font-size: 13px; color: #0b0b10;
  background: var(--av, linear-gradient(135deg, #a294ff, #5ee6d0));
  box-shadow: 0 0 0 1px rgba(255,255,255,0.1) inset;
}
.avatar.lg { width: 40px; height: 40px; font-size: 15px; }

/* ---------- 메일 목록 */
.list-pane { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-width: 0; background: var(--bg-1); }
.list-head { padding: 14px 14px 10px; display: flex; flex-direction: column; gap: 10px; border-bottom: 1px solid var(--line); }
.list-title { display: flex; align-items: center; gap: 8px; }
.list-title h2 { font-size: 16px; font-weight: 650; letter-spacing: -0.02em; flex: 1; }
.list-title .menu-btn { display: none; }
.search { position: relative; }
.search .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.search input {
  width: 100%; height: 34px; padding: 0 36px 0 33px; border-radius: 9px; outline: none;
  background: rgba(255,255,255,0.03); border: 1px solid var(--line);
  transition: border-color .2s, background .2s, box-shadow .2s;
}
.search input:focus { border-color: rgba(154,140,255,0.5); background: rgba(255,255,255,0.045); box-shadow: 0 0 0 3px rgba(154,140,255,0.1); }
.search .kbd { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); }
.list-tools { display: flex; align-items: center; gap: 2px; }
.list-tools .grow { flex: 1; }
.list-tools .sel-count { font-size: 12.5px; color: var(--text-2); padding-left: 6px; }
.list { flex: 1; overflow-y: auto; overscroll-behavior: contain; position: relative; }

.mail {
  position: relative; display: grid; grid-template-columns: auto 1fr; gap: 0 12px;
  padding: 12px 14px 12px 16px; cursor: pointer; border-bottom: 1px solid var(--line);
  transition: background .15s;
  animation: mail-in .45s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 22ms);
}
@keyframes mail-in { from { opacity: 0; transform: translateY(6px); } }
.mail:hover { background: var(--bg-hover); }
.mail.active { background: rgba(154,140,255,0.08); }
.mail.active::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: var(--accent); }
.mail.selected { background: rgba(154,140,255,0.06); }
.mail .avatar { width: 34px; height: 34px; font-size: 13px; transition: transform .2s var(--ease); }
.mail .check {
  position: absolute; width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; background: var(--accent); color: #0b0a14;
  transform: scale(0); transition: transform .25s var(--ease-spring);
}
.mail.selected .check { transform: scale(1); }
.mail-body { min-width: 0; }
.mail-top { display: flex; align-items: baseline; gap: 8px; }
.mail-from { font-size: 13.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.mail-date { font-size: 11.5px; color: var(--text-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.mail-subject { font-size: 13.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.mail-preview { font-size: 12.5px; color: var(--text-3); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 2px; line-height: 1.45; }
.mail-flags { display: flex; gap: 6px; align-items: center; margin-left: 4px; color: var(--text-3); }
.mail-flags .star { color: var(--warn); fill: var(--warn); }
.mail.unread .mail-from, .mail.unread .mail-subject { color: var(--text); font-weight: 620; }
.mail.unread::after {
  content: ""; position: absolute; left: 6px; top: 26px; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 8px var(--accent);
  animation: pulse-dot 2.4s ease-in-out infinite;
}
@keyframes pulse-dot { 50% { box-shadow: 0 0 2px var(--accent); opacity: .7; } }
.mail.leaving { animation: mail-out .32s var(--ease) forwards; }
@keyframes mail-out { to { opacity: 0; transform: translateX(-24px); height: 0; padding-top: 0; padding-bottom: 0; } }

.skeleton { padding: 14px 16px; display: grid; grid-template-columns: 34px 1fr; gap: 12px; border-bottom: 1px solid var(--line); }
.sk { border-radius: 6px; background: linear-gradient(90deg, rgba(255,255,255,0.03) 0%, rgba(255,255,255,0.07) 50%, rgba(255,255,255,0.03) 100%); background-size: 200% 100%; animation: shimmer 1.4s ease-in-out infinite; }
.sk.circle { width: 34px; height: 34px; border-radius: 50%; }
.sk.line { height: 10px; margin-bottom: 8px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.empty {
  height: 100%; min-height: 280px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  color: var(--text-3); text-align: center; padding: 24px; animation: fade-in .5s var(--ease);
}
.empty .empty-icon {
  width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center;
  background: var(--bg-2); box-shadow: 0 0 0 1px var(--line) inset; color: var(--text-2);
  animation: float 4s ease-in-out infinite;
}
@keyframes float { 50% { transform: translateY(-5px); } }
.empty h3 { color: var(--text); font-size: 14.5px; font-weight: 600; }
.empty p { font-size: 13px; max-width: 260px; }
.load-more { display: flex; justify-content: center; padding: 14px; }

/* ---------- 읽기 */
.reader { display: flex; flex-direction: column; min-width: 0; background: var(--bg); position: relative; }
.reader-bar {
  display: flex; align-items: center; gap: 2px; padding: 10px 16px; border-bottom: 1px solid var(--line); min-height: 53px;
}
.reader-bar .grow { flex: 1; }
.reader-bar .back-btn { display: none; }
.reader-scroll { flex: 1; overflow-y: auto; }
.reader-inner { max-width: 820px; margin: 0 auto; padding: 28px 32px 60px; animation: reader-in .45s var(--ease) both; }
@keyframes reader-in { from { opacity: 0; transform: translateY(8px); } }
.reader h1 { font-size: 21px; font-weight: 650; letter-spacing: -0.025em; line-height: 1.35; margin-bottom: 18px; word-break: break-word; }
.sender { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 22px; }
.sender-info { flex: 1; min-width: 0; }
.sender-name { font-weight: 600; font-size: 14px; }
.sender-name span { color: var(--text-3); font-weight: 400; font-size: 13px; margin-left: 4px; }
.sender-to { font-size: 12.5px; color: var(--text-3); margin-top: 1px; word-break: break-all; }
.sender-date { font-size: 12.5px; color: var(--text-3); white-space: nowrap; }
.e2e-badge {
  display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--ok);
  background: rgba(68,217,155,0.08); box-shadow: 0 0 0 1px rgba(68,217,155,0.18) inset;
  padding: 3px 9px 3px 7px; border-radius: 99px; margin-bottom: 14px; font-weight: 500;
}
.banner {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; margin-bottom: 16px;
  background: var(--bg-2); box-shadow: 0 0 0 1px var(--line) inset; font-size: 13px; color: var(--text-2);
  animation: rise .4s var(--ease);
}
.banner .grow { flex: 1; }
.banner .btn { height: 28px; padding: 0 10px; font-size: 12.5px; }
.mail-text { white-space: pre-wrap; word-break: break-word; font-size: 14.5px; line-height: 1.7; color: #dcdce2; }
.mail-text a { text-decoration: underline; text-underline-offset: 2px; }
.mail-html-wrap { border-radius: 12px; overflow: hidden; background: #fff; box-shadow: 0 0 0 1px var(--line); }
.mail-html { width: 100%; border: 0; display: block; min-height: 80px; background: #fff; }
.attachments { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.attachment {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; max-width: 260px;
  background: var(--bg-2); box-shadow: 0 0 0 1px var(--line) inset; text-align: left;
  transition: transform .2s var(--ease), box-shadow .2s, background .2s;
}
.attachment:hover { transform: translateY(-2px); box-shadow: 0 0 0 1px var(--line-2) inset, 0 8px 20px -10px rgba(0,0,0,0.8); background: var(--bg-3); }
.attachment .ext { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; font-size: 10px; font-weight: 700; background: var(--accent-soft); color: var(--accent); text-transform: uppercase; flex: none; }
.attachment .att-info { min-width: 0; }
.attachment .att-name { font-size: 12.5px; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attachment .att-size { font-size: 11.5px; color: var(--text-3); }
.reply-bar { display: flex; gap: 8px; margin-top: 28px; }

.reader-empty { flex: 1; display: grid; place-items: center; }
.reader-empty .inner { display: flex; flex-direction: column; align-items: center; gap: 18px; color: var(--text-3); text-align: center; }
.reader-empty .infinity { width: 120px; height: 60px; opacity: .9; }
.reader-empty .infinity path { stroke-width: 4; }
.reader-empty p { font-size: 13px; }
.shortcuts { display: flex; gap: 16px; font-size: 12px; color: var(--text-3); }
.shortcuts span { display: inline-flex; align-items: center; gap: 6px; }

/* ============================================================ 쓰기 창 */
.compose {
  position: fixed; right: 24px; bottom: 0; width: 560px; max-width: calc(100vw - 32px);
  height: min(620px, calc(100vh - 80px));
  background: var(--bg-2); border-radius: 14px 14px 0 0;
  box-shadow: 0 0 0 1px var(--line-2), 0 -10px 60px -10px rgba(0,0,0,0.8);
  display: flex; flex-direction: column; z-index: 60;
  transform-origin: bottom right;
  animation: compose-in .45s var(--ease-spring) both;
}
@keyframes compose-in { from { opacity: 0; transform: translateY(40px) scale(0.96); } }
.compose.closing { animation: compose-out .25s var(--ease) forwards; }
@keyframes compose-out { to { opacity: 0; transform: translateY(30px) scale(0.97); } }
.compose.minimized { height: 46px; }
.compose.minimized .compose-body, .compose.minimized .compose-foot { display: none; }
.compose-head {
  display: flex; align-items: center; gap: 4px; padding: 6px 8px 6px 16px; height: 46px; flex: none;
  border-bottom: 1px solid var(--line); cursor: pointer;
}
.compose-head h3 { font-size: 13.5px; font-weight: 600; flex: 1; }
.compose-body { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.compose-row { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--line); min-height: 44px; }
.compose-row label { font-size: 13px; color: var(--text-3); width: 74px; flex: none; white-space: nowrap; }
.compose-row input { flex: 1; height: 44px; background: none; border: 0; outline: none; min-width: 0; }
.compose-row .from { font-size: 13px; color: var(--text-2); }
.compose-row .cc-toggle { font-size: 12.5px; color: var(--text-3); }
.compose-row .cc-toggle:hover { color: var(--text); }
.compose textarea {
  flex: 1; resize: none; background: none; border: 0; outline: none; padding: 16px; font-size: 14.5px; line-height: 1.65;
}
.compose-foot { display: flex; align-items: center; gap: 8px; padding: 10px 12px 10px 16px; border-top: 1px solid var(--line); padding-bottom: calc(10px + var(--safe-b)); }
.compose-foot .grow { flex: 1; }
.compose-foot .note { font-size: 11.5px; color: var(--text-3); display: flex; align-items: center; gap: 5px; }

/* ============================================================ 모달 */
.overlay {
  position: fixed; inset: 0; z-index: 80; background: rgba(0,0,0,0.55);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: grid; place-items: center; padding: 20px;
  animation: fade-in .25s var(--ease);
}
.overlay.closing { animation: fade-out .2s var(--ease) forwards; }
@keyframes fade-out { to { opacity: 0; } }
.modal {
  width: 100%; max-width: 640px; max-height: min(720px, calc(100vh - 40px));
  background: var(--bg-1); border-radius: 18px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; overflow: hidden;
  animation: modal-in .45s var(--ease-spring) both;
}
@keyframes modal-in { from { opacity: 0; transform: translateY(14px) scale(0.96); } }
.overlay.closing .modal { animation: modal-out .2s var(--ease) forwards; }
@keyframes modal-out { to { opacity: 0; transform: scale(0.97); } }
.modal-head { display: flex; align-items: center; padding: 18px 18px 0 22px; }
.modal-head h2 { font-size: 17px; font-weight: 650; flex: 1; letter-spacing: -0.02em; }
.tabs { display: flex; gap: 2px; padding: 14px 18px 0; border-bottom: 1px solid var(--line); position: relative; }
.tab { padding: 8px 12px 12px; font-size: 13.5px; color: var(--text-2); font-weight: 550; position: relative; transition: color .15s; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); }
.tab.active::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--accent); animation: tab-ink .35s var(--ease); }
@keyframes tab-ink { from { transform: scaleX(0.3); opacity: 0; } }
.modal-body { padding: 22px; overflow-y: auto; display: flex; flex-direction: column; gap: 18px; }
.modal-body > * { animation: rise .45s var(--ease) both; }
.modal-body > *:nth-child(2) { animation-delay: .04s; }
.modal-body > *:nth-child(3) { animation-delay: .08s; }
.modal-body > *:nth-child(4) { animation-delay: .12s; }
.modal-body > *:nth-child(5) { animation-delay: .16s; }
.section { background: var(--bg-2); border-radius: 14px; box-shadow: 0 0 0 1px var(--line) inset; padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.section-head { display: flex; align-items: flex-start; gap: 12px; }
.section-head .s-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.section-head .s-text { flex: 1; }
.section-head h3 { font-size: 14px; font-weight: 600; }
.section-head p { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }
.pill { font-size: 11.5px; padding: 3px 9px; border-radius: 99px; font-weight: 600; white-space: nowrap; }
.pill.on { color: var(--ok); background: rgba(68,217,155,0.1); }
.pill.off { color: var(--text-3); background: var(--bg-3); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row > .input { flex: 1; min-width: 160px; }
.secret-box {
  font-family: var(--mono); font-size: 13px; letter-spacing: .08em; word-break: break-all;
  padding: 12px 14px; border-radius: 10px; background: var(--bg); box-shadow: 0 0 0 1px var(--line-2) inset;
  display: flex; align-items: center; gap: 10px;
}
.secret-box span { flex: 1; }
.steps { font-size: 13px; color: var(--text-2); padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table td { padding: 10px 4px; border-bottom: 1px solid var(--line); }
.table tr:last-child td { border-bottom: 0; }
.table .mono { font-family: var(--mono); font-size: 12.5px; }
.table .muted { color: var(--text-3); }
.info-grid { display: grid; grid-template-columns: 110px 1fr; gap: 10px 14px; font-size: 13.5px; }
.info-grid dt { color: var(--text-3); }
.info-grid dd { word-break: break-all; }

/* ============================================================ 토스트 */
.toasts { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px;
  background: #1e1e24; color: var(--text); padding: 10px 12px 10px 14px; border-radius: 12px; font-size: 13.5px;
  box-shadow: 0 0 0 1px var(--line-2), 0 16px 40px -10px rgba(0,0,0,0.8);
  animation: toast-in .45s var(--ease-spring) both;
}
.toast.out { animation: toast-out .25s var(--ease) forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px) scale(0.95); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px) scale(0.97); } }
.toast .icon { color: var(--ok); }
.toast.error .icon { color: var(--danger); }
.toast button { color: var(--accent); font-weight: 600; font-size: 13px; margin-left: 6px; padding: 2px 4px; }

/* ============================================================ 모바일 */
.scrim { display: none; }
@media (max-width: 1100px) {
  .shell { grid-template-columns: 220px minmax(280px, 340px) 1fr; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; position: relative; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: 272px; z-index: 70;
    transform: translateX(-100%); transition: transform .35s var(--ease);
    box-shadow: 20px 0 60px rgba(0,0,0,0.6);
    padding-bottom: calc(14px + var(--safe-b));
  }
  .shell.drawer .sidebar { transform: none; }
  .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 65; opacity: 0; pointer-events: none; transition: opacity .3s; }
  .shell.drawer .scrim { opacity: 1; pointer-events: auto; }
  .list-title .menu-btn { display: inline-grid; margin-left: -6px; }
  .list-pane { border-right: 0; height: 100%; }
  .reader {
    position: fixed; inset: 0; z-index: 50; transform: translateX(100%);
    transition: transform .4s var(--ease); box-shadow: -20px 0 50px rgba(0,0,0,0.5);
  }
  .shell.reading .reader { transform: none; }
  .shell.reading .list-pane { transform: translateX(-18%); opacity: .6; }
  .list-pane { transition: transform .4s var(--ease), opacity .4s; }
  .reader-bar .back-btn { display: inline-grid; }
  .reader-inner { padding: 20px 18px 60px; }
  .reader h1 { font-size: 19px; }
  .sender { flex-wrap: wrap; }
  .sender-date { width: 100%; padding-left: 52px; margin-top: -6px; }
  .reader-empty { display: none; }
  .compose { right: 0; left: 0; width: 100%; max-width: none; height: 100%; border-radius: 0; }
  .compose.minimized { height: 46px; }
  .search .kbd, .shortcuts { display: none; }
  .modal { max-height: calc(100vh - 20px); border-radius: 18px 18px 0 0; align-self: end; }
  .overlay { padding: 10px 0 0; }
  .info-grid { grid-template-columns: 1fr; gap: 2px; }
  .info-grid dd { margin-bottom: 8px; }
  .fab {
    position: fixed; right: 18px; bottom: calc(20px + var(--safe-b)); z-index: 40;
    width: 54px; height: 54px; border-radius: 17px; padding: 0;
    animation: fab-in .5s var(--ease-spring) .2s both;
  }
  @keyframes fab-in { from { transform: scale(0) rotate(-45deg); } }
  .toasts { bottom: calc(86px + var(--safe-b)); }
}
@media (min-width: 861px) { .fab { display: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
.mail.no-anim, .no-anim .mail { animation: none; }
.mail-avatar-wrap { position: relative; width: 34px; height: 34px; }
.mail-avatar-wrap .check { left: 0; top: 0; }
.toasts { width: calc(100vw - 32px); max-width: 520px; }
.toast { max-width: 100%; }
