/* Tymeline Mails - webmail UI
   Dark-first design shared with cloud.tymeline.net / console.tymeline.net.
   Layout: mobile (default) -> tablet (768-1024) -> desktop (1025+). */

:root, [data-theme="dark"] {
  --bg: #141414;
  --bg-2: #0f0f10;
  --surface: #1c1c1c;
  --surface-2: #242424;
  --surface-3: #2c2c2e;
  --ink: #f4f4f6;
  --ink-2: #dcdce3;
  --muted: #a7a7b4;
  --faint: #7a7a88;
  --line: rgba(255, 255, 255, 0.1);
  --line-2: rgba(255, 255, 255, 0.16);
  --accent: #673de6;
  --accent-hot: #8c5cff;
  --accent-ink: #fff;
  --accent-soft: rgba(103, 61, 230, 0.18);
  --accent-glow: rgba(140, 92, 255, 0.45);
  --danger: #ff6b8a;
  --ok: #16d890;
  --star: #f5c16c;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.3);
  --radius: 16px;
  --header: 56px;
  --desk: 64px;
  --tab: 64px;
  --font: "DM Sans", Inter, ui-sans-serif, system-ui, sans-serif;
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #f6f5fb;
  --bg-2: #ffffff;
  --surface: #ffffff;
  --surface-2: #f1edfb;
  --surface-3: #e8e2f8;
  --ink: #1a1428;
  --ink-2: #2f2742;
  --muted: #5c5670;
  --faint: #8b86a0;
  --line: rgba(103, 61, 230, 0.14);
  --line-2: rgba(103, 61, 230, 0.24);
  --accent: #673de6;
  --accent-hot: #6f45ea;
  --accent-ink: #fff;
  --accent-soft: #efe8ff;
  --accent-glow: rgba(103, 61, 230, 0.28);
  --danger: #d1436b;
  --ok: #0f9f68;
  --star: #c98912;
  --shadow: 0 12px 28px rgba(80, 40, 140, 0.1);
  --shadow-soft: 0 8px 22px rgba(80, 40, 140, 0.08);
  color-scheme: light;
}

/* ------------------------------------------------------------ base */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(ellipse 50% 40% at 80% 0%, rgba(103, 61, 230, 0.16), transparent 60%),
    var(--bg);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent-hot); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
h1, h2, h3 { letter-spacing: -0.03em; }
kbd {
  font: 600 0.7rem/1 var(--font); color: var(--muted);
  border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 6px;
  padding: 0.15rem 0.4rem; background: var(--surface-2);
}
.hidden { display: none !important; }
.app { min-height: 100dvh; }
:focus-visible { outline: 2px solid var(--accent-hot); outline-offset: 2px; }

/* ------------------------------------------------------------ controls */
.btn {
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  padding: 0 1.05rem;
  background: linear-gradient(90deg, var(--accent), var(--accent-hot));
  color: #fff;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(103, 61, 230, 0.28);
  transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.2s ease;
}
.btn:hover { filter: brightness(1.07); box-shadow: 0 10px 26px rgba(103, 61, 230, 0.38); }
.btn:active { transform: translateY(1px); }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--line-2); box-shadow: none; }
.btn-ghost:hover { background: var(--surface-2); filter: none; box-shadow: none; }
.btn-soft { background: var(--accent-soft); color: var(--accent-hot); box-shadow: none; }
.btn-block { width: 100%; }
.btn-lg { min-height: 50px; font-size: 1rem; border-radius: 14px; }
.icon-btn {
  width: 44px; height: 44px; border: 0; border-radius: 12px;
  background: transparent; color: var(--ink); display: grid; place-items: center;
  transition: background 0.15s ease, color 0.15s ease;
}
.icon-btn:hover { background: var(--surface-2); }
.field { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 0.9rem; }
.field > span:first-child { font-size: 0.8rem; font-weight: 650; color: var(--muted); letter-spacing: 0.01em; }
.control {
  min-height: 48px; width: 100%; border: 1px solid var(--line-2);
  background: var(--bg-2); border-radius: 12px; padding: 0 0.9rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
[data-theme="light"] .control { background: #fff; }
.control::placeholder { color: var(--faint); }
.control:focus { outline: none; border-color: var(--accent-hot); box-shadow: 0 0 0 3px rgba(103, 61, 230, 0.3); }
.control-wrap { position: relative; display: block; }
.control-wrap .control { padding-left: 2.7rem; }
.control-ico {
  position: absolute; left: 0.85rem; top: 50%; transform: translateY(-50%);
  width: 20px; height: 20px; color: var(--faint); pointer-events: none;
}
.control-ico svg { width: 20px; height: 20px; }
.control-wrap:focus-within .control-ico { color: var(--accent-hot); }
.password-wrap .control { padding-right: 3rem; }
.password-wrap .icon-btn { position: absolute; right: 2px; top: 2px; width: 44px; height: 44px; z-index: 2; color: var(--muted); }
.password-wrap .eye-off { display: none; }
.password-wrap .is-visible .eye-open { display: none; }
.password-wrap .is-visible .eye-off { display: block; }
.check { display: flex; align-items: center; gap: 0.55rem; min-height: 44px; color: var(--ink-2); font-size: 0.92rem; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.badge {
  min-width: 1.35rem; height: 1.35rem; padding: 0 0.42rem; border-radius: 999px;
  background: var(--accent); color: #fff; font-size: 0.7rem; font-weight: 700;
  display: inline-grid; place-items: center;
}
.avatar {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 700; font-size: 1rem; color: #fff; flex: none;
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px rgba(140, 92, 255, 0.55);
}
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tab) + 16px + env(safe-area-inset-bottom));
  transform: translateX(-50%); background: var(--surface-3); color: var(--ink);
  border: 1px solid var(--line-2); border-radius: 999px;
  padding: 0.7rem 1.1rem; z-index: 80; box-shadow: var(--shadow);
  font-weight: 600; font-size: 0.92rem; max-width: calc(100vw - 2rem);
}
.sheet-backdrop, .modal-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6); z-index: 60; backdrop-filter: blur(2px); }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 70;
  background: var(--surface); border-radius: 20px 20px 0 0;
  padding: 0.6rem 0.9rem calc(1rem + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line-2);
  box-shadow: var(--shadow);
}
.sheet-handle { width: 42px; height: 4px; border-radius: 99px; background: var(--line-2); margin: 0.2rem auto 0.7rem; }
.sheet button, .menu-row {
  width: 100%; min-height: 48px; border: 0; background: transparent; color: var(--ink);
  text-align: left; border-radius: 12px; padding: 0 0.8rem; display: flex; align-items: center; gap: 0.7rem;
}
.sheet button:hover, .menu-row:hover { background: var(--surface-2); }
.modal {
  position: fixed; z-index: 75; left: 1rem; right: 1rem; top: 50%; transform: translateY(-50%);
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 18px; padding: 1.2rem;
  box-shadow: var(--shadow);
}
.modal h2 { margin: 0 0 0.4rem; font-size: 1.15rem; }
.modal p, .modal-copy { margin: 0 0 1rem; color: var(--muted); line-height: 1.5; }
.modal-copy pre { margin: 0; max-height: 40vh; overflow: auto; color: var(--ink); }
.modal-actions { display: flex; gap: 0.5rem; }
.modal-actions .btn { flex: 1; }
.banner { border-radius: 12px; padding: 0.75rem 0.85rem; margin-bottom: 0.8rem; background: rgba(255, 107, 138, 0.12); color: var(--danger); border: 1px solid rgba(255, 107, 138, 0.35); font-size: 0.92rem; }
.banner.warn { background: rgba(245, 193, 108, 0.12); color: var(--star); border-color: rgba(245, 193, 108, 0.4); }
.lede { margin: 0 0 1.2rem; color: var(--muted); line-height: 1.55; }

/* ------------------------------------------------------------ sign in */
.login {
  position: relative; isolation: isolate;
  min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: calc(1.5rem + env(safe-area-inset-top)) 1rem calc(1.5rem + env(safe-area-inset-bottom));
  overflow: hidden;
}

/* backdrop scene: aurora + perspective grid + horizon + orbiting spark */
.login-scene { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; background: var(--bg); }
.scene-aurora { position: absolute; border-radius: 50%; filter: blur(80px); opacity: 0.7; mix-blend-mode: screen; }
.scene-aurora-a { width: 60vmax; height: 60vmax; left: 50%; top: -30vmax; transform: translateX(-50%); background: radial-gradient(circle, rgba(124, 77, 255, 0.5), rgba(103, 61, 230, 0.12) 45%, transparent 70%); animation: aurora-a 16s ease-in-out infinite alternate; }
.scene-aurora-b { width: 46vmax; height: 46vmax; left: -14vmax; bottom: -22vmax; background: radial-gradient(circle, rgba(22, 216, 144, 0.22), transparent 65%); animation: aurora-b 20s ease-in-out infinite alternate; }
.scene-grid {
  position: absolute; left: -50%; right: -50%; bottom: -10%; height: 62%;
  background-image:
    linear-gradient(rgba(140, 92, 255, 0.22) 1px, transparent 1px),
    linear-gradient(90deg, rgba(140, 92, 255, 0.22) 1px, transparent 1px);
  background-size: 64px 64px;
  transform: perspective(600px) rotateX(64deg);
  transform-origin: 50% 0;
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 25%, #000 70%, transparent 100%);
  mask-image: linear-gradient(180deg, transparent 0, #000 25%, #000 70%, transparent 100%);
  animation: grid-flow 6s linear infinite;
}
.scene-horizon {
  position: absolute; left: 0; right: 0; bottom: 38%; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(140, 92, 255, 0.7) 30%, rgba(255, 255, 255, 0.9) 50%, rgba(140, 92, 255, 0.7) 70%, transparent);
  box-shadow: 0 0 24px rgba(140, 92, 255, 0.6);
  opacity: 0.6;
}
.scene-orbit {
  position: absolute; left: 50%; top: 50%; width: min(820px, 140vw); aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%; border: 1px dashed rgba(140, 92, 255, 0.16);
  animation: orbit-spin 40s linear infinite;
}
.scene-orbit i {
  position: absolute; top: -4px; left: 50%; width: 8px; height: 8px; border-radius: 50%;
  background: #fff; box-shadow: 0 0 12px 4px rgba(140, 92, 255, 0.8);
}
@keyframes aurora-a { to { transform: translateX(-42%) translateY(6vmax) scale(1.08); } }
@keyframes aurora-b { to { transform: translate(10vmax, -8vmax) scale(1.15); } }
@keyframes grid-flow { to { background-position: 0 64px; } }
@keyframes orbit-spin { to { transform: translate(-50%, -50%) rotate(360deg); } }

.login-stack { width: min(420px, 100%); display: flex; flex-direction: column; align-items: center; gap: 1.4rem; }
.login-brand { display: flex; flex-direction: column; align-items: center; gap: 0.8rem; animation: rise 0.7s cubic-bezier(0.22, 1, 0.36, 1) both; }
.login-brand img { height: 54px; width: auto; max-width: min(260px, 80vw); object-fit: contain; filter: drop-shadow(0 8px 24px rgba(103, 61, 230, 0.45)); }
.login-status {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted);
  padding: 0.35rem 0.8rem; border-radius: 999px;
  border: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 60%, transparent);
  backdrop-filter: blur(8px);
}
.login-status i { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 rgba(22, 216, 144, 0.6); animation: pulse-dot 2.2s ease-out infinite; }
@keyframes pulse-dot { 0% { box-shadow: 0 0 0 0 rgba(22, 216, 144, 0.6); } 100% { box-shadow: 0 0 0 9px rgba(22, 216, 144, 0); } }

.login-card {
  position: relative; width: 100%;
  padding: 1.6rem 1.35rem 1.3rem;
  border-radius: 22px;
  background: linear-gradient(160deg, color-mix(in srgb, var(--surface) 82%, transparent), color-mix(in srgb, var(--bg-2) 70%, transparent));
  border: 1px solid rgba(140, 92, 255, 0.28);
  backdrop-filter: blur(18px) saturate(1.2);
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 0 0 1px rgba(255, 255, 255, 0.02);
  animation: card-in 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.1s both;
  overflow: hidden;
}
[data-theme="light"] .login-card { box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.8); }
/* soft inner glow from the top */
.login-card::before {
  content: ""; position: absolute; inset: -40% -20% auto; height: 70%; z-index: 0; pointer-events: none;
  background: radial-gradient(50% 60% at 50% 100%, rgba(140, 92, 255, 0.22), transparent 70%);
}
.login-card > * { position: relative; z-index: 1; }
/* HUD corner brackets */
.corner { position: absolute; width: 18px; height: 18px; border: 1.5px solid rgba(140, 92, 255, 0.85); z-index: 2; pointer-events: none; transition: width 0.3s ease, height 0.3s ease; }
.c-tl { top: 10px; left: 10px; border-right: 0; border-bottom: 0; border-top-left-radius: 8px; }
.c-tr { top: 10px; right: 10px; border-left: 0; border-bottom: 0; border-top-right-radius: 8px; }
.c-bl { bottom: 10px; left: 10px; border-right: 0; border-top: 0; border-bottom-left-radius: 8px; }
.c-br { bottom: 10px; right: 10px; border-left: 0; border-top: 0; border-bottom-right-radius: 8px; }
.login-card:focus-within .corner { width: 26px; height: 26px; }
/* beam that sweeps along the top edge */
.beam {
  position: absolute; top: 0; left: -30%; width: 30%; height: 1.5px; z-index: 2; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.95), transparent);
  filter: drop-shadow(0 0 6px rgba(140, 92, 255, 0.9));
  animation: beam-sweep 4.5s ease-in-out 1s infinite;
}
@keyframes beam-sweep { 0% { left: -30%; } 60%, 100% { left: 100%; } }

.login-card h1 { margin: 0 0 0.25rem; font-size: 1.7rem; font-weight: 800; }
.login-card .lede { font-size: 0.92rem; margin-bottom: 1.2rem; }
.login-card .field > span:first-child { font-size: 0.68rem; letter-spacing: 0.14em; text-transform: uppercase; font-weight: 700; }
.login-card .control { background: color-mix(in srgb, var(--bg) 70%, transparent); border-color: var(--line-2); }
.login-card .control:focus { background: color-mix(in srgb, var(--bg) 90%, transparent); box-shadow: 0 0 0 3px rgba(103, 61, 230, 0.28), 0 0 24px rgba(103, 61, 230, 0.25); }
.login-card .field, .login-card .login-row, .login-card .btn, .login-card .links { animation: rise 0.55s cubic-bezier(0.22, 1, 0.36, 1) both; }
.login-card .field:nth-of-type(1) { animation-delay: 0.2s; }
.login-card .field:nth-of-type(2) { animation-delay: 0.28s; }
.login-card .login-row { animation-delay: 0.36s; }
.login-card .btn { animation-delay: 0.42s; }
.login-card .links { animation-delay: 0.5s; }
.login-row { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; margin: -0.1rem 0 0.6rem; font-size: 0.88rem; }
.login-row a { font-weight: 600; }
.btn-lg { box-shadow: 0 10px 30px rgba(103, 61, 230, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.25); }
.btn-lg::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: -40%; width: 40%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.28), transparent);
  transform: skewX(-20deg);
  animation: shine-sweep 3.8s ease-in-out 1.6s infinite;
}
.links { display: flex; justify-content: center; gap: 0.4rem; margin: 1rem 0 0; font-size: 0.9rem; color: var(--muted); }
.links a { font-weight: 650; }
.login-secure {
  margin: 0; font-size: 0.7rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); text-align: center;
  animation: rise 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.6s both;
}
@keyframes card-in { from { opacity: 0; transform: translateY(22px) scale(0.97); } to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes shine-sweep { 0% { left: -40%; } 35%, 100% { left: 120%; } }

/* ------------------------------------------------------------ create account */
.join { min-height: 100dvh; display: flex; flex-direction: column; background: var(--bg); }
.join-body { padding: 1.1rem 1rem 2rem; max-width: 760px; margin: 0 auto; width: 100%; }
.join-kicker { margin: 0 0 0.35rem; color: var(--accent-hot); font-size: 0.78rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.join-body h2 { margin: 0 0 0.5rem; font-size: 1.7rem; }
.join-card {
  margin: 1.1rem 0; padding: 1.1rem 1rem; border-radius: 20px;
  background: var(--surface); border: 1px solid rgba(103, 61, 230, 0.35);
  animation: card-in 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.join-card h3 { margin: 0 0 0.4rem; font-size: 1.25rem; }
.feature-grid { list-style: none; margin: 0.9rem 0 0; padding: 0; display: grid; gap: 0.55rem; }
.feature-grid li {
  display: flex; flex-direction: column; gap: 0.15rem; min-height: 64px; justify-content: center;
  padding: 0.7rem 0.8rem; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line);
}
.feature-grid span { color: var(--muted); font-size: 0.88rem; }
.join-body .btn { margin-top: 0.55rem; }

/* ------------------------------------------------------------ shell chrome */
.deskbar { display: none; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  height: calc(var(--header) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 0.35rem 0;
  display: flex; align-items: center; gap: 0.1rem;
  background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar h1 {
  flex: 1; min-width: 0; margin: 0; font-size: 1.05rem; text-align: center;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.topbar .icon-btn { flex: none; position: relative; z-index: 2; }
.profile-btn {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-hot)); color: #fff; font-weight: 700;
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px rgba(140, 92, 255, 0.5);
}
.profile-btn:hover { filter: brightness(1.08); background: linear-gradient(135deg, var(--accent), var(--accent-hot)); }
.topbar .count {
  display: inline-grid; place-items: center; margin-left: 0.35rem; vertical-align: middle;
  color: var(--accent-hot); font-weight: 700; font-size: 0.7rem;
  padding: 0.15rem 0.5rem; border-radius: 999px; background: var(--accent-soft);
}
.topbar .count:empty { display: none; }
.pane { padding: 0.35rem 0 calc(var(--tab) + 1rem + env(safe-area-inset-bottom)); }
.state-switch { display: flex; gap: 0.4rem; overflow: auto; padding: 0.5rem 0.75rem 0; }

/* sidebar / drawer content */
.side-account {
  display: flex; align-items: center; gap: 0.75rem;
  margin: 0.9rem 0.75rem 0.6rem; padding: 0.75rem;
  border-radius: 16px; background: var(--surface); border: 1px solid var(--line);
}
.side-account .avatar { width: 40px; height: 40px; font-size: 0.95rem; }
.side-account strong { display: block; font-size: 0.92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-account p { margin: 0.1rem 0 0; font-size: 0.76rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-account div { min-width: 0; }
.side-label { margin: 0.6rem 1.1rem 0.25rem; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); }
.folder {
  width: calc(100% - 1.2rem); margin: 0.1rem 0.6rem; min-height: 44px; border: 0;
  background: transparent; color: var(--ink-2); border-radius: 12px;
  display: flex; align-items: center; gap: 0.7rem; padding: 0 0.75rem; text-align: left;
  font-weight: 500; position: relative;
  transition: background 0.15s ease, color 0.15s ease;
}
.folder svg { flex: none; color: var(--muted); transition: color 0.15s ease; }
.folder:hover { background: var(--surface-2); color: var(--ink); }
.folder.on { background: var(--accent-soft); color: var(--ink); font-weight: 650; }
.folder.on svg { color: var(--accent-hot); }
.folder.on::before { content: ""; position: absolute; left: -0.6rem; top: 25%; bottom: 25%; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent-hot); }
.folder .badge { margin-left: auto; }
.folder-add { color: var(--muted); margin-top: 0.35rem; }
.folder-add:hover { color: var(--accent-hot); }
.side-foot {
  margin: auto 1.1rem 1rem; padding-top: 0.9rem; font-size: 0.74rem; color: var(--faint);
  display: flex; align-items: center; gap: 0.45rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.side-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px rgba(22, 216, 144, 0.18); flex: none; }

/* ------------------------------------------------------------ message list */
.swipe { position: relative; margin: 0.35rem 0.75rem; border-radius: 16px; overflow: hidden; }
.swipe-actions { position: absolute; inset: 0; z-index: 0; display: flex; justify-content: space-between; }
.swipe-actions button { width: 84px; border: 0; color: #fff; font-weight: 700; }
.swipe-actions .keep { background: var(--accent); }
.mail {
  position: relative; z-index: 1; width: 100%; min-width: 0;
  border: 1px solid var(--line); border-radius: 16px;
  background: var(--surface); display: grid; grid-template-columns: 44px minmax(0, 1fr) 32px;
  align-items: start; column-gap: 0.75rem;
  padding: 0.8rem 0.6rem 0.8rem 0.85rem; text-align: left; min-height: 80px; overflow: hidden;
  transition: transform 0.16s ease, background 0.15s ease, border-color 0.15s ease;
}
.mail:hover { border-color: var(--line-2); background: var(--surface-2); }
.mail .avatar { width: 42px; height: 42px; font-size: 0.95rem; margin-top: 0.1rem; }
.mail-main { min-width: 0; display: block; }
.row1 { display: flex; align-items: baseline; justify-content: space-between; gap: 0.6rem; }
.who { display: flex; align-items: center; gap: 0.4rem; min-width: 0; font-weight: 600; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row1 time { flex: none; font-size: 0.74rem; color: var(--faint); font-variant-numeric: tabular-nums; }
.subject { margin: 0.15rem 0 0; color: var(--ink-2); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 0.35rem; }
.subject .clip { flex: none; color: var(--muted); }
.preview { margin: 0.12rem 0 0; color: var(--muted); font-size: 0.84rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.preview:empty { display: none; }
.meta { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent-hot); display: inline-block; flex: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.star { color: var(--faint); background: none; border: 0; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 10px; font-size: 1.05rem; transition: color 0.15s ease, background 0.15s ease, transform 0.15s ease; }
.star:hover { color: var(--star); background: var(--surface-3); transform: scale(1.08); }
.star.on { color: var(--star); }
.mail.is-unread { border-color: rgba(140, 92, 255, 0.35); }
.mail.is-unread::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: linear-gradient(180deg, var(--accent-hot), var(--accent)); }
.mail.is-unread .who { color: var(--ink); font-weight: 700; }
.mail.is-unread .subject { color: var(--ink); font-weight: 650; }
.mail.is-unread .row1 time { color: var(--accent-hot); }
.mail.is-selected { background: var(--accent-soft); border-color: rgba(140, 92, 255, 0.55); }
.mail.is-selected:hover { background: var(--accent-soft); }

/* ------------------------------------------------------------ mobile nav */
.fab {
  position: fixed; right: 1rem; bottom: calc(var(--tab) + 0.85rem + env(safe-area-inset-bottom));
  width: 58px; height: 58px; border: 0; border-radius: 18px;
  background: linear-gradient(145deg, var(--accent), var(--accent-hot)); color: #fff;
  box-shadow: 0 14px 30px rgba(103, 61, 230, 0.45); z-index: 30; display: grid; place-items: center;
}
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
  height: calc(var(--tab) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.tabbar button {
  border: 0; background: transparent; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0.2rem; font-size: 0.66rem; font-weight: 600; min-height: 44px; position: relative;
}
.tabbar svg { width: 22px; height: 22px; }
.tabbar button.on { color: var(--accent-hot); }
.tabbar button.on::before { content: ""; position: absolute; top: 0; left: 30%; right: 30%; height: 2px; border-radius: 0 0 3px 3px; background: var(--accent-hot); }
.drawer {
  position: fixed; z-index: 65; inset: 0 auto 0 0; width: min(300px, 86vw);
  background: var(--bg); border-right: 1px solid var(--line);
  transform: translateX(-105%); transition: transform 0.22s ease;
  padding-top: env(safe-area-inset-top); overflow: auto;
  display: flex; flex-direction: column;
}
.drawer[hidden] { display: none; }
.drawer.open { transform: none; box-shadow: var(--shadow); }

/* ------------------------------------------------------------ reader */
.reader, .compose, .search, .full {
  position: fixed; inset: 0; z-index: 35; background: var(--bg);
  display: flex; flex-direction: column; padding-top: env(safe-area-inset-top);
}
.full { bottom: calc(var(--tab) + env(safe-area-inset-bottom)); }
.reader-body, .compose-body, .search-body { overflow: auto; padding: 1rem 1rem 5.5rem; }
.search { align-items: stretch; }
.search .topbar { width: 100%; flex: none; }
.search-body { width: 100%; }
.search-body .control { display: block; margin: 0 0 0.75rem; }
.reader-head { padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
.subject-lg { margin: 0.3rem 0 0.9rem; font-size: 1.4rem; line-height: 1.25; overflow-wrap: anywhere; }
.sender { display: flex; gap: 0.8rem; align-items: center; }
.sender > div { min-width: 0; flex: 1; }
.sender strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sender p { margin: 0.15rem 0 0; color: var(--muted); font-size: 0.84rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sender time { flex: none; font-size: 0.78rem; color: var(--faint); align-self: flex-start; margin-top: 0.2rem; }
.mail-copy {
  line-height: 1.65; color: var(--ink); font-size: 1rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  padding: 1.05rem 1.1rem; margin-top: 1rem; overflow-wrap: anywhere; word-break: break-word;
}
.mail-copy p { margin: 0 0 0.85rem; }
.mail-copy p:last-child { margin-bottom: 0; }
.mail-copy a { color: var(--accent-hot); }
.mail-copy img, .mail-copy table { max-width: 100%; }
.mail-copy table { display: block; overflow-x: auto; }
.mail-copy pre { white-space: pre-wrap; font-family: inherit; margin: 0; }
.attach {
  display: flex; align-items: center; gap: 0.7rem; margin-top: 0.7rem;
  border: 1px solid var(--line); background: var(--surface); border-radius: 14px; padding: 0.75rem 0.9rem;
  color: var(--ink-2);
}
.attach svg { color: var(--accent-hot); flex: none; }
.read-tools {
  position: sticky; top: 0; z-index: 5;
  container-type: inline-size; container-name: tools;
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  padding: 0.4rem 0.5rem; padding-top: calc(0.4rem + env(safe-area-inset-top));
  background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.tool-main {
  display: flex; align-items: center; gap: 0.1rem; min-width: 0; flex: 0 1 auto;
  padding: 0.2rem; border-radius: 14px; background: var(--surface); border: 1px solid var(--line);
}
.tool-nav { display: flex; align-items: center; gap: 0.1rem; flex: none; }
.tool {
  width: 40px; height: 40px; flex: none;
  border: 0; border-radius: 10px; background: transparent; color: var(--muted);
  display: grid; place-items: center; transition: background 0.15s ease, color 0.15s ease;
}
.tool:hover, .tool.on { background: var(--accent-soft); color: var(--accent-hot); }
/* Collapse lower-priority actions into "More" as the toolbar gets narrower.
   Tiers: always (back, reply, forward, star, delete, more) ->
          .tool-sec needs >= 480px (reply all, archive) ->
          .tool-ter needs >= 640px (unread, move, spam). */
@container tools (max-width: 639px) { .tool-ter { display: none; } }
@container tools (max-width: 479px) { .tool-sec { display: none; } }
@container tools (max-width: 379px) { .tool { width: 36px; height: 36px; } .tool-main { gap: 0; } .read-tools { gap: 0.3rem; } }
@container tools (max-width: 329px) { .tool { width: 32px; height: 32px; } .tool svg { width: 18px; height: 18px; } }

/* ------------------------------------------------------------ compose */
.compose-row { display: flex; align-items: center; gap: 0.5rem; min-height: 48px; border-bottom: 1px solid var(--line); }
.compose-row label { width: 3.6rem; color: var(--muted); font-size: 0.82rem; font-weight: 600; }
.compose-row input { flex: 1; border: 0; background: transparent; min-height: 44px; outline: none; }
.format-bar {
  display: flex; align-items: center; gap: 0.15rem; flex-wrap: wrap;
  margin: 0.7rem 0 0.4rem; padding: 0.35rem;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px;
}
.format-bar select, .format-bar button {
  min-height: 36px; min-width: 36px; border: 0; border-radius: 8px;
  background: transparent; color: var(--ink);
}
.format-bar button:hover, .format-bar select:hover { background: var(--accent-soft); color: var(--accent-hot); }
.format-bar select { padding: 0 0.4rem; }
.editor {
  width: 100%; min-height: 50vh; border: 0; background: transparent; outline: none;
  line-height: 1.6; padding: 0.9rem 0.2rem 1.2rem; color: var(--ink);
}
.editor:empty::before { content: attr(data-placeholder); color: var(--faint); }
.editor .mail-trail, .mail-copy .mail-trail, .mail-copy blockquote {
  margin: 0.8rem 0 0; padding: 0.2rem 0 0.2rem 0.85rem;
  border-left: 3px solid var(--accent); color: var(--muted);
}
.editor .mail-sign { margin-top: 0.6rem; color: var(--muted); }
.compose-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 0.6rem;
  padding: 0.55rem 0.7rem calc(0.55rem + env(safe-area-inset-bottom));
  background: var(--surface); border-top: 1px solid var(--line);
}
.compose-foot-links { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.compose-foot-links button { min-height: 44px; border: 0; background: transparent; color: var(--muted); border-radius: 10px; padding: 0 0.5rem; font-weight: 500; }
.compose-foot-links button:hover { color: var(--accent-hot); background: var(--accent-soft); }
.compose-foot .btn { min-width: 110px; border-radius: 12px; }

/* ------------------------------------------------------------ search, contacts, settings */
.chips { display: flex; gap: 0.4rem; overflow: auto; padding: 0.55rem 0.75rem; }
.chip { border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); border-radius: 999px; min-height: 34px; padding: 0 0.85rem; white-space: nowrap; font-size: 0.86rem; font-weight: 600; }
.chip.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.contact {
  display: flex; gap: 0.75rem; align-items: center; width: calc(100% - 1.5rem); margin: 0.4rem 0.75rem;
  border: 1px solid var(--line); border-radius: 16px; background: var(--surface); padding: 0.75rem; text-align: left; min-height: 68px;
}
.contact:hover { border-color: var(--line-2); background: var(--surface-2); }
.contact small { color: var(--muted); }
.account-card, .account-balance { display: none; }
.account-actions { padding: 0.4rem 0.9rem 1rem; }
.account-actions .btn + .btn { margin-top: 0.5rem; }
#logout-btn { background: rgba(255, 107, 138, 0.14); color: var(--danger); border: 1px solid rgba(255, 107, 138, 0.35); box-shadow: none; }
#logout-btn:hover { background: rgba(255, 107, 138, 0.22); }
.sign-editor { margin: 0.9rem; }
.sign-editor label { display: block; margin-bottom: 0.4rem; color: var(--muted); font-size: 0.85rem; }
.sign-box {
  width: 100%; min-height: 160px; resize: vertical;
  border: 1px solid var(--line-2); border-radius: 14px;
  background: var(--surface); color: var(--ink); padding: 0.8rem; line-height: 1.5;
}
.settings-group { margin: 0.8rem 0.9rem; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.settings-group h2 { margin: 0; padding: 0.85rem 0.9rem 0.2rem; font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); }
.settings-group .menu-row { border-radius: 0; }
.settings-group .menu-row + .menu-row { border-top: 1px solid var(--line); }

/* ------------------------------------------------------------ states */
.empty { padding: 2.6rem 1.2rem; text-align: center; color: var(--muted); }
.empty h2 { margin: 0 0 0.35rem; color: var(--ink); font-size: 1.15rem; }
.empty p { margin: 0; line-height: 1.5; }
.empty-art { width: 64px; height: 64px; margin: 0 auto 0.9rem; display: grid; place-items: center; border-radius: 20px; background: var(--accent-soft); color: var(--accent-hot); }
.empty-art svg { width: 30px; height: 30px; }
.empty-reader .empty-art { width: 120px; height: 120px; background: transparent; color: var(--muted); }
.empty-reader .empty-art svg { width: 120px; height: 120px; }
.sk { height: 80px; margin: 0.4rem 0.75rem; border-radius: 16px; background: linear-gradient(90deg, var(--surface), var(--surface-2), var(--surface)); background-size: 200% 100%; animation: shine 1.2s infinite; }
.mail-loader {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0.85rem; min-height: 220px; padding: 2rem 1rem; color: var(--muted);
}
.mail-loader p { margin: 0; font-size: 0.92rem; }
.spin {
  width: 42px; height: 42px; border-radius: 50%;
  border: 3px solid rgba(103, 61, 230, 0.22); border-top-color: var(--accent-hot);
  animation: spin 0.75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shine { to { background-position: -200% 0; } }
.desktop-read, .sidebar { display: none; }

@media (prefers-reduced-motion: reduce) {
  .login-card, .login-card .field, .login-card .login-row, .login-card .btn, .login-card .links, .login-brand, .login-secure,
  .scene-aurora, .scene-grid, .scene-orbit, .login-status i, .beam, .btn-lg::after, .join-card, .mail { animation: none !important; }
  .btn-lg::after, .beam { display: none; }
}

/* ============================================================ mobile and tablet */
@media (max-width: 1024px) {
  .list-col > .topbar { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; }
  .list-col > .topbar h1 { text-align: center; }
  .top-actions { display: flex; align-items: center; gap: 0.1rem; }
  .full .topbar { background: var(--bg); border-bottom: 1px solid var(--line); }
  #settings { background: var(--bg); }
  #settings .account-bar h1 { text-align: center; }
  #settings .account-balance { display: block; width: 44px; height: 44px; flex: none; }
  #settings .account-card {
    display: flex; align-items: center; gap: 0.9rem;
    margin: 0.9rem 0.9rem 0.2rem; padding: 1rem;
    background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  }
  #settings .account-card .avatar { width: 52px; height: 52px; font-size: 1.15rem; flex: none; }
  #settings .account-card strong { display: block; overflow-wrap: anywhere; }
  #settings .account-card p { margin: 0.15rem 0 0; color: var(--muted); font-size: 0.85rem; }
  #settings .account-actions { padding-bottom: 0.4rem; }
  .compose-foot { flex-wrap: wrap; }
  .compose-foot .btn { margin-left: auto; }
}
@media (min-width: 768px) and (max-width: 1024px) {
  .shell { display: grid; grid-template-columns: 260px minmax(0, 1fr); height: 100dvh; }
  .sidebar { display: flex; flex-direction: column; background: var(--bg); border-right: 1px solid var(--line); overflow: auto; }
  .mobile-menu, .tabbar { display: none; }
  .fab { bottom: 1.25rem; }
  .pane { padding-bottom: 5rem; }
  .list-col { min-width: 0; overflow: auto; }
  .topbar h1 { text-align: left; }
  .login { width: min(560px, 100%); margin: 0 auto; }
}
@media (min-width: 768px) {
  .modal { left: 50%; right: auto; width: min(440px, calc(100% - 2rem)); transform: translate(-50%, -50%); }
  .feature-grid { grid-template-columns: 1fr 1fr; }
  .join-body h2 { font-size: 2.1rem; }
}

/* ============================================================ desktop */
@media (min-width: 1025px) {
  .tabbar, .fab, .mobile-menu, #drawer { display: none !important; }

  /* sign in */
  .login-stack { width: 440px; gap: 1.7rem; }
  .login-brand img { height: 64px; max-width: 300px; }
  .login-card { padding: 2rem 1.9rem 1.6rem; border-radius: 26px; }
  .login-card h1 { font-size: 1.9rem; }
  .scene-grid { background-size: 80px 80px; }
  @keyframes grid-flow { to { background-position: 0 80px; } }

  /* chrome */
  .deskbar {
    display: flex; grid-column: 1 / -1; align-items: center; gap: 1rem;
    height: var(--desk); padding: 0 1.1rem;
    background: var(--bg); border-bottom: 1px solid var(--line); overflow: hidden;
  }
  .deskbar img { flex: 0 0 auto; height: 40px; width: auto; max-width: 176px; object-fit: contain; object-position: left center; }
  .desk-search {
    position: relative; flex: 1 1 auto; min-width: 0; max-width: 560px; margin: 0 auto;
    min-height: 42px; border-radius: 999px; border: 1px solid var(--line-2);
    background: var(--surface); color: var(--muted); text-align: left;
    padding: 0 0.9rem 0 1rem; display: flex; align-items: center; gap: 0.6rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  }
  .desk-search:hover { border-color: rgba(140, 92, 255, 0.5); background: var(--surface-2); }
  .desk-search:focus-visible { box-shadow: 0 0 0 3px rgba(103, 61, 230, 0.3); }
  .desk-search span { flex: 1; }
  .desk-search svg { flex: none; }
  .desk-end { margin-left: auto; display: flex; align-items: center; gap: 0.7rem; flex: none; }
  .btn-compose { min-height: 42px; border-radius: 999px; padding: 0 1.1rem 0 0.9rem; }
  #open-search, #open-profile { display: none; }
  .shell {
    display: grid;
    grid-template-columns: 252px minmax(360px, 420px) minmax(0, 1fr);
    grid-template-rows: var(--desk) minmax(0, 1fr);
    height: 100dvh;
  }
  .sidebar, .list-col, .desktop-read { min-height: 0; }
  .sidebar { display: flex; flex-direction: column; background: var(--bg); border-right: 1px solid var(--line); overflow: auto; padding-bottom: 0.5rem; }
  .list-col { border-right: 1px solid var(--line); overflow: auto; min-width: 0; background: var(--bg); }
  .desktop-read {
    display: flex; flex-direction: column; min-width: 0; overflow: auto;
    background:
      radial-gradient(ellipse 60% 40% at 80% 0%, rgba(103, 61, 230, 0.12), transparent 55%),
      var(--bg-2);
  }
  .desktop-read .empty { margin: auto; max-width: 380px; }
  .desktop-read .reader-body { padding: 1.4rem 2rem 2.4rem; max-width: 960px; width: 100%; margin: 0 auto; }
  .desktop-read .reader-head { padding-bottom: 1.1rem; }
  .desktop-read .subject-lg { font-size: 1.7rem; }
  .desktop-read .read-tools { background: color-mix(in srgb, var(--bg-2) 92%, transparent); padding: 0.5rem 1.3rem; }
  .desktop-read .tool[data-back] { display: none; }
  .pane { padding-bottom: 1.2rem; }
  .topbar { position: sticky; background: color-mix(in srgb, var(--bg) 94%, transparent); border-bottom-color: var(--line); height: 60px; padding: 0 0.6rem; }
  .topbar h1 { text-align: left; padding-left: 0.5rem; font-size: 1.2rem; font-weight: 700; }
  .state-switch { padding: 0.5rem 0.75rem 0.2rem; }
  .swipe { margin: 0.3rem 0.6rem; border-radius: 14px; }
  .swipe-actions { display: none; }
  .mail { border-radius: 14px; background: transparent; border-color: transparent; min-height: 76px; padding: 0.7rem 0.55rem 0.7rem 0.8rem; }
  .mail:hover { background: var(--surface); border-color: var(--line); }
  .mail.is-unread { background: color-mix(in srgb, var(--surface) 55%, transparent); border-color: rgba(140, 92, 255, 0.22); }
  .mail.is-selected, .mail.is-selected:hover { background: var(--accent-soft); border-color: rgba(140, 92, 255, 0.55); }
  .mail .avatar { box-shadow: none; }
  .reader.mobile-only { display: none; }
  .full {
    top: var(--desk); left: 252px; right: 0; bottom: 0; padding: 0;
    background: var(--bg); align-items: stretch; justify-content: flex-start;
  }
  .full .topbar { background: var(--bg); border-bottom: 1px solid var(--line); }
  .full .pane { max-width: 760px; width: 100%; }
  .search {
    top: var(--desk); left: 0; right: 0; bottom: 0; padding: 1.5rem;
    background: rgba(0, 0, 0, 0.55); backdrop-filter: blur(3px);
    align-items: center; justify-content: flex-start;
  }
  .search .topbar, .search .search-body { width: min(680px, 100%); background: var(--surface); }
  .search .topbar { border-radius: 18px 18px 0 0; border: 1px solid var(--line-2); border-bottom: 0; height: 60px; }
  .search .search-body { border-radius: 0 0 18px 18px; border: 1px solid var(--line-2); border-top: 0; padding-top: 0.4rem; max-height: 70vh; box-shadow: var(--shadow); }
  .compose {
    top: 5rem; left: 50%; bottom: auto; right: auto;
    width: min(900px, calc(100% - 3rem)); height: min(86vh, 900px);
    transform: translateX(-50%);
    border: 1px solid var(--line-2); border-radius: 20px;
    box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.5), var(--shadow); overflow: hidden; background: var(--surface);
  }
  .compose .topbar { background: var(--surface); height: 60px; }
  .compose .topbar h1 { font-size: 1.05rem; }
  .toast { bottom: 1.4rem; }
}

/* ============================================================ futuristic shell
   Carries the sign-in language into the mailbox: glass chrome, faint scene
   behind the panes, glowing active states, HUD accents on the reader. */
.shell { position: relative; isolation: isolate; }
.shell-scene { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; background: var(--bg); }
.shell-scene .scene-aurora-a { opacity: 0.4; animation-duration: 28s; }
.scene-dots {
  position: absolute; inset: 0;
  background-image: radial-gradient(rgba(140, 92, 255, 0.16) 1px, transparent 1.2px);
  background-size: 26px 26px;
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 70% 30%, #000 20%, transparent 75%);
  mask-image: radial-gradient(ellipse 70% 60% at 70% 30%, #000 20%, transparent 75%);
}
[data-theme="light"] .scene-dots { opacity: 0.6; }

/* glass chrome */
.deskbar, .topbar, .tabbar, .compose-foot, .full .topbar, .compose .topbar {
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  backdrop-filter: blur(18px) saturate(1.2);
}
.deskbar { border-bottom: 0; position: relative; }
.deskbar::after, .topbar::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(140, 92, 255, 0.45) 30%, rgba(140, 92, 255, 0.45) 70%, transparent);
}
.topbar { border-bottom-color: transparent; }
.desk-search {
  background: color-mix(in srgb, var(--surface) 55%, transparent);
  border-color: rgba(140, 92, 255, 0.22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.desk-search:hover { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 0 24px rgba(103, 61, 230, 0.2); }
.btn-compose { box-shadow: 0 8px 24px rgba(103, 61, 230, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.25); }
.profile-btn { box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px rgba(140, 92, 255, 0.6), 0 0 18px rgba(140, 92, 255, 0.35); }

/* sidebar */
.sidebar, .drawer { background: transparent; border-right-color: transparent; position: relative; }
.sidebar::after { content: ""; position: absolute; top: 0; bottom: 0; right: 0; width: 1px; background: linear-gradient(180deg, rgba(140, 92, 255, 0.4), transparent 60%); }
.drawer { background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(18px); }
.side-account {
  background: color-mix(in srgb, var(--surface) 55%, transparent);
  border-color: rgba(140, 92, 255, 0.2);
  backdrop-filter: blur(10px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.side-account .avatar { box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px rgba(140, 92, 255, 0.6), 0 0 16px rgba(140, 92, 255, 0.4); }
.side-label { letter-spacing: 0.16em; }
.folder { border-radius: 12px; }
.folder.on {
  background: linear-gradient(90deg, rgba(103, 61, 230, 0.28), rgba(103, 61, 230, 0.06));
  box-shadow: inset 0 0 0 1px rgba(140, 92, 255, 0.22);
}
.folder.on::before { box-shadow: 0 0 12px 2px rgba(140, 92, 255, 0.6); }
.side-foot { margin: auto 0.9rem 1rem; padding-top: 0.9rem; display: flex; justify-content: center; }
.side-foot .login-status { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* message list */
.list-col { background: transparent; border-right-color: transparent; position: relative; }
.list-col::after { content: ""; position: absolute; top: 0; bottom: 0; right: 0; width: 1px; background: linear-gradient(180deg, rgba(140, 92, 255, 0.4), transparent 60%); pointer-events: none; }
.topbar .count { box-shadow: 0 0 14px rgba(140, 92, 255, 0.35); }
.mail { background: color-mix(in srgb, var(--surface) 55%, transparent); backdrop-filter: blur(8px); }
/* swipe actions sit behind the row on touch layouts, so the row must stay opaque there */
@media (max-width: 1024px) { .mail { background: var(--surface); backdrop-filter: none; } }
.mail .avatar { box-shadow: none; }
.mail.is-unread::before { box-shadow: 0 0 12px 1px rgba(140, 92, 255, 0.55); }
.mail.is-selected, .mail.is-selected:hover {
  background: linear-gradient(90deg, rgba(103, 61, 230, 0.3), rgba(103, 61, 230, 0.08));
  border-color: rgba(140, 92, 255, 0.55);
  box-shadow: 0 0 0 1px rgba(140, 92, 255, 0.15), 0 10px 30px rgba(103, 61, 230, 0.18);
}
.dot { box-shadow: 0 0 0 3px var(--accent-soft), 0 0 10px rgba(140, 92, 255, 0.8); }
.chip { background: color-mix(in srgb, var(--surface) 55%, transparent); }
.chip.on { box-shadow: 0 0 16px rgba(103, 61, 230, 0.45); }

/* reader */
.desktop-read { background: transparent; }
.read-tools { background: transparent; backdrop-filter: none; border-bottom: 0; }
.tool-main {
  background: color-mix(in srgb, var(--surface) 60%, transparent);
  border-color: rgba(140, 92, 255, 0.22);
  backdrop-filter: blur(14px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 8px 24px rgba(0, 0, 0, 0.25);
}
.tool-nav {
  padding: 0.2rem; border-radius: 14px;
  background: color-mix(in srgb, var(--surface) 60%, transparent);
  border: 1px solid rgba(140, 92, 255, 0.16); backdrop-filter: blur(14px);
}
.tool:hover, .tool.on { box-shadow: 0 0 14px rgba(103, 61, 230, 0.35); }
.reader-head { border-bottom: 0; position: relative; }
.reader-head::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: linear-gradient(90deg, rgba(140, 92, 255, 0.6), rgba(140, 92, 255, 0.1) 60%, transparent);
}
.sender .avatar { box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px rgba(140, 92, 255, 0.45); }
.mail-copy {
  position: relative;
  background: color-mix(in srgb, var(--surface) 62%, transparent);
  border-color: rgba(140, 92, 255, 0.2);
  backdrop-filter: blur(14px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 20px 50px rgba(0, 0, 0, 0.3);
}
/* HUD brackets on the message card */
.mail-copy::before, .mail-copy::after {
  content: ""; position: absolute; width: 14px; height: 14px; pointer-events: none;
  border: 1.5px solid rgba(140, 92, 255, 0.7);
}
.mail-copy::before { top: 8px; left: 8px; border-right: 0; border-bottom: 0; border-top-left-radius: 6px; }
.mail-copy::after { bottom: 8px; right: 8px; border-left: 0; border-top: 0; border-bottom-right-radius: 6px; }
.attach {
  background: color-mix(in srgb, var(--surface) 55%, transparent);
  border-color: rgba(140, 92, 255, 0.2);
  backdrop-filter: blur(10px);
}
.attach:hover { border-color: rgba(140, 92, 255, 0.5); box-shadow: 0 0 20px rgba(103, 61, 230, 0.2); }

/* empty reader: orbit ring behind the illustration */
.empty-reader { position: relative; }
.empty-orbit {
  position: absolute; left: 50%; top: 50px; width: 260px; height: 260px;
  transform: translateX(-50%); border-radius: 50%;
  border: 1px dashed rgba(140, 92, 255, 0.25);
  animation: orbit-ring 36s linear infinite; pointer-events: none;
}
.empty-orbit i {
  position: absolute; top: -4px; left: 50%; width: 7px; height: 7px; border-radius: 50%;
  background: #fff; box-shadow: 0 0 10px 3px rgba(140, 92, 255, 0.75);
}
@keyframes orbit-ring { to { transform: translateX(-50%) rotate(360deg); } }
.empty-reader .empty-art { position: relative; margin-top: 70px; margin-bottom: 1.6rem; filter: drop-shadow(0 0 18px rgba(140, 92, 255, 0.35)); }
.empty-reader h2 { font-weight: 800; }
.empty-reader kbd { color: var(--accent-hot); border-color: rgba(140, 92, 255, 0.4); }

/* overlays */
.compose, .search .topbar, .search .search-body, .sheet, .modal {
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(22px) saturate(1.2);
  border-color: rgba(140, 92, 255, 0.28);
}
.compose .topbar { background: transparent; }
.format-bar { background: color-mix(in srgb, var(--surface-2) 70%, transparent); border-color: rgba(140, 92, 255, 0.16); }
.fab { box-shadow: 0 14px 30px rgba(103, 61, 230, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.08) inset; }
.tabbar { border-top-color: transparent; position: fixed; }
.tabbar::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(140, 92, 255, 0.45) 30%, rgba(140, 92, 255, 0.45) 70%, transparent);
}
.tabbar button.on::before { box-shadow: 0 0 12px 2px rgba(140, 92, 255, 0.6); }
.settings-group, .contact, .sign-box, #settings .account-card {
  background: color-mix(in srgb, var(--surface) 60%, transparent);
  border-color: rgba(140, 92, 255, 0.18);
  backdrop-filter: blur(10px);
}

@media (prefers-reduced-motion: reduce) {
  .shell-scene .scene-aurora, .empty-orbit { animation: none !important; }
}

/* Cloud client-area skin */
body { background: #141414; }
.btn, .btn-lg, .btn-compose, .fab {
  background: #673de6;
  border-radius: 8px;
  box-shadow: none;
}
.btn::after, .btn-lg::after { display: none; }
.btn:hover, .btn-compose:hover, .fab:hover { background: #7e56f2; filter: none; box-shadow: none; }
.login {
  display: block;
  width: auto;
  margin: 0;
  min-height: 100dvh;
  padding: 0;
  background:
    radial-gradient(ellipse 50% 40% at 80% 18%, rgba(103, 61, 230, 0.1), transparent 60%),
    #141414;
}
.login-scene, .shell-scene, .corner, .beam, .empty-orbit { display: none !important; }
.auth-shell { min-height: 100dvh; display: grid; place-items: center; padding: 2.5rem 1.25rem 3rem; }
.auth-split { width: min(980px, 100%); display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; align-items: stretch; }
.auth-aside, .login-card {
  background: #1c1c1c;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}
.auth-aside {
  padding: 2rem 1.75rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 520px;
}
.auth-logo { height: 54px; width: auto; max-width: 220px; object-fit: contain; margin-bottom: 1.2rem; filter: none; }
.hh-kicker { margin: 0 0 0.85rem; color: #c4b5fd; font-size: 0.78rem; font-weight: 600; }
.auth-aside h1 { margin: 0 0 0.7rem; font-size: 1.85rem; letter-spacing: -0.04em; line-height: 1.15; }
.auth-aside p { margin: 0; color: #c8c8d2; line-height: 1.6; }
.auth-aside ul { margin: 1.25rem 0 0; padding: 0; list-style: none; display: grid; gap: 0.55rem; }
.auth-aside li { font-weight: 600; font-size: 0.95rem; }
.auth-aside li::before { content: "\2713  "; color: #8c5cff; }
.auth-aside-foot { margin-top: 1.5rem; font-size: 0.88rem; }
.login-card {
  width: auto;
  padding: 1.75rem 1.6rem;
  backdrop-filter: none;
  animation: none;
  overflow: visible;
}
.login-card::before { display: none; }
.login-card h2 { margin: 0 0 0.35rem; font-size: 1.55rem; letter-spacing: -0.04em; }
.login-card .lede { margin-bottom: 1.1rem; }
.login-card .field > span:first-child { font-size: 0.84rem; letter-spacing: 0; text-transform: none; font-weight: 600; }
.login-card .control { background: #141414; border-color: rgba(255, 255, 255, 0.14); border-radius: 8px; }
.login-card .control:focus { box-shadow: 0 0 0 3px rgba(103, 61, 230, 0.35); }
.login-card .field, .login-card .login-row, .login-card .btn, .login-card .links { animation: none; }
.deskbar, .topbar, .tabbar, .compose-foot, .full .topbar, .compose .topbar {
  background: #141414;
  backdrop-filter: none;
}
.deskbar { border-bottom: 1px solid rgba(255, 255, 255, 0.12); }
.deskbar::after, .topbar::after, .tabbar::before, .sidebar::after, .list-col::after, .reader-head::after { display: none; }
.deskbar img { height: 40px; width: auto; max-width: 180px; object-fit: contain; }
.desk-search {
  background: #1c1c1c;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: none;
  border-radius: 8px;
}
.profile-btn { width: 28px; height: 28px; background: #673de6; box-shadow: none; font-size: 0.75rem; }
.sidebar, .list-col, .desktop-read { background: #141414; }
.sidebar { background: #1c1c1c; border-right: 1px solid rgba(255, 255, 255, 0.12); }
.list-col { border-right: 1px solid rgba(255, 255, 255, 0.12); }
.side-account { background: #141414; border-color: rgba(255, 255, 255, 0.12); backdrop-filter: none; box-shadow: none; }
.side-account .avatar, .sender .avatar { box-shadow: none; }
.folder { width: 100%; margin: 0; border-radius: 0; border-left: 3px solid transparent; }
.folder.on {
  background: rgba(103, 61, 230, 0.14);
  color: #673de6;
  box-shadow: none;
  border-left-color: #673de6;
}
.folder.on::before { display: none; }
.folder.on svg { color: #673de6; }
.mail, .mail.is-unread, .mail.is-selected, .mail.is-selected:hover {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  backdrop-filter: none;
}
.mail:hover, .mail.is-selected, .mail.is-selected:hover { background: rgba(103, 61, 230, 0.12); }
.mail.is-unread::before, .dot { box-shadow: none; }
.mail-copy { background: #1c1c1c; border: 1px solid rgba(255, 255, 255, 0.12); backdrop-filter: none; box-shadow: none; }
.mail-copy::before, .mail-copy::after { display: none; }
.tool-main, .tool-nav, .attach, .chip { background: #1c1c1c; border-color: rgba(255, 255, 255, 0.12); backdrop-filter: none; box-shadow: none; }
.tool:hover, .tool.on { box-shadow: none; background: rgba(103, 61, 230, 0.12); }
.compose, .search .topbar, .search .search-body, .sheet, .modal, .settings-group, .contact, .sign-box, #settings .account-card {
  background: #1c1c1c;
  backdrop-filter: none;
  border-color: rgba(255, 255, 255, 0.12);
}
.tabbar { background: #141414; border-top: 1px solid rgba(255, 255, 255, 0.12); }
.tabbar button.on::before { box-shadow: none; background: #673de6; }
@media (max-width: 860px) {
  .auth-split { grid-template-columns: 1fr; }
  .login-card { order: -1; }
  .auth-aside { min-height: 0; }
}
