@font-face {
  font-family: "Inter";
  src: url("fonts/inter-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* ================= Tokens ================= */
:root {
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --bg: #f4f5f8;
  --sidebar: #eceef3;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --hover: #f1f3f7;
  --border: #e3e6ec;
  --border-strong: #d3d8e1;
  --text: #0f172a;
  --text-2: #475569;
  --muted: #64748b;
  --faint: #94a3b8;

  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #eef0ff;
  --accent-soft-2: #e0e4ff;
  --accent-ink: #3730a3;
  --on-accent: #ffffff;
  --ring: rgba(79, 70, 229, .28);

  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --danger-border: #fecaca;
  --success: #16a34a;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 16px rgba(15, 23, 42, .06);
  --shadow-lg: 0 12px 48px rgba(15, 23, 42, .18), 0 2px 8px rgba(15, 23, 42, .08);

  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;

  --av-0: #e0e7ff; --av-0-ink: #4338ca;
  --av-1: #dcfce7; --av-1-ink: #15803d;
  --av-2: #fef3c7; --av-2-ink: #b45309;
  --av-3: #fce7f3; --av-3-ink: #be185d;
  --av-4: #e0f2fe; --av-4-ink: #0369a1;
  --av-5: #ede9fe; --av-5-ink: #6d28d9;
  --av-6: #ffedd5; --av-6-ink: #c2410c;
  --av-7: #ccfbf1; --av-7-ink: #0f766e;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0d12;
    --sidebar: #0e1117;
    --surface: #13161d;
    --surface-2: #181c24;
    --hover: #1c212b;
    --border: #232936;
    --border-strong: #2f3646;
    --text: #e8ebf1;
    --text-2: #b1b9c7;
    --muted: #8a94a6;
    --faint: #626c7e;
    --accent: #6d68f5;
    --accent-hover: #7f7bff;
    --accent-soft: rgba(109, 104, 245, .14);
    --accent-soft-2: rgba(109, 104, 245, .22);
    --accent-ink: #c4c6ff;
    --ring: rgba(127, 123, 255, .4);
    --danger: #f87171;
    --danger-soft: rgba(248, 113, 113, .1);
    --danger-border: rgba(248, 113, 113, .3);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .3);
    --shadow-lg: 0 16px 56px rgba(0, 0, 0, .55), 0 2px 8px rgba(0, 0, 0, .4);
    --av-0: #262a52; --av-0-ink: #a5b4fc;
    --av-1: #16332a; --av-1-ink: #86efac;
    --av-2: #3a2e14; --av-2-ink: #fcd34d;
    --av-3: #3d1d2f; --av-3-ink: #f9a8d4;
    --av-4: #13314a; --av-4-ink: #7dd3fc;
    --av-5: #2e2350; --av-5-ink: #c4b5fd;
    --av-6: #3d2414; --av-6-ink: #fdba74;
    --av-7: #123532; --av-7-ink: #5eead4;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0b0d12;
  --sidebar: #0e1117;
  --surface: #13161d;
  --surface-2: #181c24;
  --hover: #1c212b;
  --border: #232936;
  --border-strong: #2f3646;
  --text: #e8ebf1;
  --text-2: #b1b9c7;
  --muted: #8a94a6;
  --faint: #626c7e;
  --accent: #6d68f5;
  --accent-hover: #7f7bff;
  --accent-soft: rgba(109, 104, 245, .14);
  --accent-soft-2: rgba(109, 104, 245, .22);
  --accent-ink: #c4c6ff;
  --ring: rgba(127, 123, 255, .4);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, .1);
  --danger-border: rgba(248, 113, 113, .3);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .3);
  --shadow-lg: 0 16px 56px rgba(0, 0, 0, .55), 0 2px 8px rgba(0, 0, 0, .4);
  --av-0: #262a52; --av-0-ink: #a5b4fc;
  --av-1: #16332a; --av-1-ink: #86efac;
  --av-2: #3a2e14; --av-2-ink: #fcd34d;
  --av-3: #3d1d2f; --av-3-ink: #f9a8d4;
  --av-4: #13314a; --av-4-ink: #7dd3fc;
  --av-5: #2e2350; --av-5-ink: #c4b5fd;
  --av-6: #3d2414; --av-6-ink: #fdba74;
  --av-7: #123532; --av-7-ink: #5eead4;
  color-scheme: dark;
}

/* ================= Base ================= */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
}
h1, h2, h3, p { margin: 0; }
button { font: inherit; color: inherit; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.icon {
  width: 18px; height: 18px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}

kbd {
  display: inline-grid; place-items: center;
  min-width: 20px; height: 20px; padding: 0 5px;
  font: 600 11px/1 var(--font);
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
}

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ================= Buttons ================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 14px;
  border: 1px solid var(--border-strong); border-radius: 10px;
  background: var(--surface); color: var(--text);
  font-weight: 550; font-size: 14px; letter-spacing: -.005em;
  cursor: pointer; white-space: nowrap;
  box-shadow: var(--shadow-sm);
  transition: background .15s, border-color .15s, box-shadow .15s, transform .08s;
}
.btn:hover { background: var(--hover); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .65; cursor: progress; }
.btn .icon { width: 16px; height: 16px; }
.btn.primary {
  background: var(--accent); border-color: transparent; color: var(--on-accent);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .12), inset 0 1px 0 rgba(255, 255, 255, .14);
}
.btn.primary:hover { background: var(--accent-hover); }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn.ghost:hover { background: var(--hover); color: var(--text); }
.btn.sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 9px; }
.btn.lg { height: 46px; font-size: 15px; border-radius: 12px; }
.btn.block { width: 100%; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 34px; height: 34px; flex: none;
  border: 0; border-radius: 9px;
  background: transparent; color: var(--muted);
  cursor: pointer;
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn:disabled { opacity: .35; cursor: default; background: transparent; }

.spinning .icon { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.logo {
  display: inline-grid; place-items: center;
  width: 38px; height: 38px; border-radius: 11px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  box-shadow: 0 4px 14px rgba(99, 102, 241, .35), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.logo .icon { width: 20px; height: 20px; stroke-width: 2; }
.logo.sm { width: 30px; height: 30px; border-radius: 9px; }
.logo.sm .icon { width: 16px; height: 16px; }

.alert {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 10px 12px; border-radius: 10px;
  background: var(--danger-soft); color: var(--danger);
  border: 1px solid var(--danger-border);
  font-size: 13px; font-weight: 500;
}
.alert .icon { width: 16px; height: 16px; margin-top: 1px; }

/* ================= Avatars ================= */
.avatar {
  display: inline-grid; place-items: center; flex: none;
  width: 36px; height: 36px; border-radius: 50%;
  font-size: 13px; font-weight: 650; letter-spacing: .01em;
  background: var(--av-0); color: var(--av-0-ink);
  user-select: none;
}
.avatar.lg { width: 44px; height: 44px; font-size: 15px; }
.avatar.c0 { background: var(--av-0); color: var(--av-0-ink); }
.avatar.c1 { background: var(--av-1); color: var(--av-1-ink); }
.avatar.c2 { background: var(--av-2); color: var(--av-2-ink); }
.avatar.c3 { background: var(--av-3); color: var(--av-3-ink); }
.avatar.c4 { background: var(--av-4); color: var(--av-4-ink); }
.avatar.c5 { background: var(--av-5); color: var(--av-5-ink); }
.avatar.c6 { background: var(--av-6); color: var(--av-6-ink); }
.avatar.c7 { background: var(--av-7); color: var(--av-7-ink); }

/* ================= Login ================= */
.auth {
  height: 100%;
  display: grid;
  grid-template-columns: minmax(420px, 1.05fr) 1fr;
  overflow: auto;
}

.auth-hero {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between; gap: 40px;
  padding: 40px 56px;
  color: #fff;
  background:
    radial-gradient(900px 500px at 110% -10%, rgba(167, 139, 250, .55), transparent 60%),
    radial-gradient(700px 500px at -20% 110%, rgba(56, 189, 248, .35), transparent 60%),
    linear-gradient(150deg, #1e1b4b 0%, #3730a3 48%, #5b21b6 100%);
}
.auth-hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(rgba(255, 255, 255, .08) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, .9), transparent 85%);
}
.auth-hero > * { position: relative; z-index: 1; }
.hero-brand { display: flex; align-items: center; gap: 12px; font-weight: 650; font-size: 16px; letter-spacing: -.01em; }
.hero-brand .logo { background: rgba(255, 255, 255, .14); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .22); backdrop-filter: blur(6px); }

.hero-copy { max-width: 470px; }
.hero-copy h1 { font-size: clamp(32px, 3.4vw, 44px); line-height: 1.08; letter-spacing: -.035em; font-weight: 700; }
.hero-copy h1 span {
  background: linear-gradient(90deg, #c7d2fe, #f0abfc);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-copy > p { margin-top: 16px; font-size: 16px; line-height: 1.6; color: rgba(255, 255, 255, .78); max-width: 400px; }
.hero-features { list-style: none; padding: 0; margin: 32px 0 0; display: grid; gap: 14px; }
.hero-features li { display: flex; align-items: center; gap: 14px; }
.hero-features strong { display: block; font-size: 14px; font-weight: 600; }
.hero-features span:not(.feat-icon) { font-size: 13px; color: rgba(255, 255, 255, .68); }
.feat-icon {
  display: grid; place-items: center; flex: none;
  width: 40px; height: 40px; border-radius: 11px;
  background: rgba(255, 255, 255, .1);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16);
}
.feat-icon .icon { width: 19px; height: 19px; }

.hero-art { position: relative; width: 100%; max-width: 440px; height: 168px; pointer-events: none; }
.float-card {
  position: absolute; display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; border-radius: 14px;
  background: rgba(255, 255, 255, .1);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18), 0 20px 40px rgba(15, 10, 60, .35);
  backdrop-filter: blur(10px);
  animation: float 7s ease-in-out infinite;
}
.float-card.c1 { width: 210px; top: 0; left: 0; flex-direction: column; align-items: flex-start; gap: 8px; }
.float-card.c2 { width: 240px; top: 46px; left: 170px; animation-delay: -2.4s; }
.float-card.c3 { width: 170px; top: 112px; left: 40px; animation-delay: -4.6s; }
@media (max-height: 760px) { .hero-art { display: none; } }
.float-card.c3 .icon { color: #86efac; width: 20px; height: 20px; }
.fc-dot { width: 8px; height: 8px; border-radius: 50%; background: #a5b4fc; box-shadow: 0 0 0 4px rgba(165, 180, 252, .2); }
.fc-avatar { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, #f0abfc, #818cf8); flex: none; }
.fc-lines { display: grid; gap: 7px; flex: 1; }
.fc-line { display: block; height: 7px; border-radius: 4px; background: rgba(255, 255, 255, .32); }
.fc-line.w45 { width: 45%; } .fc-line.w55 { width: 55%; } .fc-line.w60 { width: 60%; }
.fc-line.w70 { width: 70%; } .fc-line.w80 { width: 80%; }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

.hero-foot { font-size: 12.5px; color: rgba(255, 255, 255, .6); letter-spacing: .01em; }

.auth-panel {
  display: grid; place-items: center;
  padding: 40px 24px;
  background: var(--surface);
}
.auth-form { width: 100%; max-width: 380px; }
.auth-mobile-brand { display: none; align-items: center; gap: 10px; font-weight: 650; font-size: 16px; margin-bottom: 28px; }
.auth-form h2 { font-size: 28px; letter-spacing: -.03em; font-weight: 700; }
.auth-sub { color: var(--muted); margin-top: 6px; font-size: 15px; }

.field { margin-top: 20px; }
.field > label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 7px; color: var(--text); }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap .lead { position: absolute; left: 13px; color: var(--faint); pointer-events: none; transition: color .15s; }
.input-wrap input {
  width: 100%; height: 46px;
  padding: 0 44px 0 42px;
  font: inherit; font-size: 15px; color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border-strong); border-radius: 12px;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.input-wrap input::placeholder { color: var(--faint); }
.input-wrap input:hover { border-color: var(--faint); }
.input-wrap input:focus { outline: none; background: var(--surface); border-color: var(--accent); box-shadow: 0 0 0 4px var(--ring); }
.input-wrap:focus-within .lead { color: var(--accent); }
.reveal {
  position: absolute; right: 6px;
  display: grid; place-items: center; width: 34px; height: 34px;
  border: 0; border-radius: 8px; background: transparent; color: var(--faint); cursor: pointer;
}
.reveal:hover { color: var(--text); background: var(--hover); }

.otp { display: flex; align-items: center; gap: 8px; }
.otp-digit {
  width: 100%; min-width: 0; height: 52px;
  text-align: center;
  font: 600 22px/1 var(--font); font-variant-numeric: tabular-nums;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border-strong); border-radius: 12px;
  caret-color: var(--accent);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.otp-digit:hover { border-color: var(--faint); }
.otp-digit:focus { outline: none; background: var(--surface); border-color: var(--accent); box-shadow: 0 0 0 4px var(--ring); }
.otp-digit.filled { background: var(--surface); border-color: var(--accent-soft-2); }
.otp-sep { width: 10px; height: 2px; flex: none; border-radius: 2px; background: var(--border-strong); }
.otp.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 8px; }

.auth-form .alert { margin-top: 18px; }
.auth-form .btn.lg { margin-top: 24px; }
.auth-form .btn.lg .icon { transition: transform .2s; }
.auth-form .btn.lg:hover .icon { transform: translateX(3px); }
.auth-foot { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 22px; font-size: 12.5px; color: var(--muted); }
.auth-foot .icon { width: 14px; height: 14px; }

/* ================= App shell ================= */
.shell {
  height: 100%;
  display: grid;
  grid-template-columns: 248px minmax(320px, 400px) 1fr;
}

/* Sidebar */
.sidebar {
  display: flex; flex-direction: column; gap: 6px;
  padding: 16px 12px 14px;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  min-height: 0;
}
.side-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 14px; font-weight: 650; font-size: 15px; letter-spacing: -.01em; }
.compose-btn { height: 40px; margin-bottom: 10px; }
.nav { display: grid; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  height: 36px; padding: 0 10px;
  border: 0; border-radius: 9px;
  background: transparent; color: var(--text-2);
  font-weight: 550; text-align: left; cursor: pointer;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--hover); color: var(--text); }
.nav-item.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.nav-item.active .icon { color: var(--accent); }
.nav-item .nav-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge {
  min-width: 22px; height: 20px; padding: 0 7px;
  display: inline-grid; place-items: center;
  font-size: 11.5px; font-weight: 650;
  border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-ink);
}
.side-spacer { flex: 1; }
.shortcut-hint {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; margin-bottom: 6px;
  border: 1px dashed var(--border-strong); border-radius: 9px;
  background: transparent; color: var(--muted); font-size: 12.5px; cursor: pointer;
}
.shortcut-hint:hover { color: var(--text); border-color: var(--faint); }
.shortcut-hint .icon { width: 16px; height: 16px; }
.me {
  display: flex; align-items: center; gap: 10px;
  padding: 10px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--border);
}
.me-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.me-text strong { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-text span { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.side-actions .btn { justify-content: flex-start; padding: 0 10px; }

/* List pane */
.list-pane {
  position: relative;
  display: flex; flex-direction: column; min-height: 0; min-width: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
}
.mobile-bar { display: none; }
.list-header { padding: 18px 16px 12px; border-bottom: 1px solid var(--border); }
.list-title { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.list-title h1 { font-size: 20px; font-weight: 700; letter-spacing: -.025em; }
.list-title #refresh-btn { margin-left: auto; }
.count-pill { font-size: 12px; font-weight: 600; color: var(--muted); background: var(--hover); padding: 2px 9px; border-radius: 999px; }
.search {
  display: flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 8px 0 12px;
  background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 10px;
  color: var(--faint);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.search:focus-within { background: var(--surface); border-color: var(--accent); box-shadow: 0 0 0 4px var(--ring); color: var(--accent); }
.search .icon { width: 16px; height: 16px; }
.search input { flex: 1; min-width: 0; height: 100%; border: 0; background: transparent; font: inherit; color: var(--text); outline: none; }
.search input::placeholder { color: var(--faint); }
.search input::-webkit-search-cancel-button { cursor: pointer; }

.list-scroll { position: relative; flex: 1; overflow-y: auto; overscroll-behavior: contain; }
.progress {
  position: sticky; top: 0; z-index: 2; height: 2px; overflow: hidden;
  background: transparent;
}
.progress::after {
  content: ""; position: absolute; inset: 0; width: 35%;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: progress 1s ease-in-out infinite;
}
@keyframes progress { from { transform: translateX(-100%); } to { transform: translateX(300%); } }

.message-list { list-style: none; margin: 0; padding: 6px 8px 12px; }
.group-label {
  position: sticky; top: 0; z-index: 1;
  padding: 12px 10px 6px;
  font-size: 11.5px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase;
  color: var(--faint);
  background: linear-gradient(var(--surface) 70%, transparent);
}
.mail-item {
  position: relative;
  display: flex; gap: 12px; width: 100%;
  padding: 12px 12px 12px 14px; margin: 1px 0;
  border: 0; border-radius: 12px;
  background: transparent; text-align: left; cursor: pointer;
  transition: background .12s;
}
.mail-item:hover { background: var(--hover); }
.mail-item.active { background: var(--accent-soft); }
.mail-item.active::before {
  content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--accent);
}
.mi-body { flex: 1; min-width: 0; display: grid; gap: 2px; }
.mi-top { display: flex; align-items: baseline; gap: 8px; }
.mi-from { flex: 1; min-width: 0; font-weight: 550; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mi-date { flex: none; font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }
.mi-subject { font-size: 13.5px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mi-meta { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--faint); min-width: 0; }
.mi-addr { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mi-chip { display: inline-flex; align-items: center; gap: 3px; flex: none; padding: 1px 7px 1px 5px; border-radius: 999px; background: var(--hover); color: var(--muted); font-size: 11px; font-weight: 550; }
.mi-chip .icon { width: 12px; height: 12px; }
.mail-item.unread .mi-from { color: var(--text); font-weight: 700; }
.mail-item.unread .mi-subject { color: var(--text); font-weight: 600; }
.mail-item.unread .mi-date { color: var(--accent); font-weight: 600; }
.unread-dot { position: absolute; left: 4px; top: 50%; width: 6px; height: 6px; margin-top: -3px; border-radius: 50%; background: var(--accent); }

.skeleton .sk-row { display: flex; gap: 12px; padding: 14px 12px; }
.sk-avatar, .sk-line {
  background: linear-gradient(90deg, var(--hover) 0%, var(--surface-2) 50%, var(--hover) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.3s ease-in-out infinite;
}
.sk-avatar { width: 36px; height: 36px; border-radius: 50%; flex: none; }
.sk-lines { flex: 1; display: grid; gap: 8px; padding-top: 3px; }
.sk-line { height: 9px; border-radius: 5px; }
.sk-line.a { width: 45%; } .sk-line.b { width: 85%; } .sk-line.c { width: 60%; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.empty-state { display: grid; justify-items: center; gap: 6px; padding: 56px 24px; text-align: center; color: var(--muted); }
.empty-state strong { color: var(--text); font-size: 15px; font-weight: 650; }
.empty-art {
  display: grid; place-items: center; width: 60px; height: 60px; margin-bottom: 8px;
  border-radius: 18px; background: var(--accent-soft); color: var(--accent);
}
.empty-art .icon { width: 26px; height: 26px; }

.pager {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px 8px 18px; border-top: 1px solid var(--border);
  font-size: 12.5px; color: var(--muted);
}
.pager-btns { display: flex; gap: 2px; }

.fab { display: none; }

/* Reader */
.reader-pane { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--bg); }
.reader-empty {
  margin: auto; display: grid; justify-items: center; gap: 6px; padding: 24px;
  text-align: center; color: var(--muted);
}
.reader-empty strong { color: var(--text); font-size: 16px; font-weight: 650; margin-top: 10px; }
.reader-empty-art { position: relative; width: 120px; height: 96px; }
.env-back {
  position: absolute; left: 10px; top: 8px; width: 92px; height: 70px; border-radius: 16px;
  background: var(--accent-soft); transform: rotate(-8deg);
}
.env-front {
  position: absolute; right: 6px; bottom: 4px; width: 92px; height: 70px; border-radius: 16px;
  display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
  color: var(--accent);
}
.env-front .icon { width: 32px; height: 32px; stroke-width: 1.5; }
.kbd-row { display: flex; align-items: center; gap: 4px; margin-top: 14px; font-size: 12.5px; }

.reader { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 12px 20px 20px; gap: 14px; overflow-y: auto; }
.reader-toolbar { display: flex; align-items: center; gap: 6px; }
.toolbar-spacer { flex: 1; }
.back-btn { display: none; }
.reader-head {
  padding: 22px 24px 20px;
  background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.reader-head h1 { font-size: 21px; line-height: 1.3; font-weight: 700; letter-spacing: -.02em; overflow-wrap: anywhere; margin-bottom: 18px; }
.sender { display: flex; align-items: flex-start; gap: 12px; }
.sender-text { flex: 1; min-width: 0; }
.sender-line { display: flex; align-items: baseline; flex-wrap: wrap; column-gap: 8px; }
.sender-line strong { font-weight: 650; font-size: 14.5px; }
.addr { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.recipients { display: flex; flex-wrap: wrap; column-gap: 14px; margin-top: 3px; font-size: 13px; color: var(--text-2); overflow-wrap: anywhere; }
.rlabel { color: var(--faint); }
.r-date { flex: none; font-size: 12.5px; color: var(--muted); text-align: right; line-height: 1.45; white-space: nowrap; }
.r-date span { display: block; color: var(--faint); font-size: 12px; }

.attachments { list-style: none; padding: 0; margin: 18px 0 0; display: flex; flex-wrap: wrap; gap: 10px; }
.attachments:empty { display: none; }
.att {
  display: flex; align-items: center; gap: 10px;
  width: 230px; max-width: 100%; padding: 9px 10px 9px 9px;
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface-2); color: var(--text); text-decoration: none;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.att:hover { border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--ring); }
.att-type {
  display: grid; place-items: center; flex: none;
  width: 38px; height: 38px; border-radius: 9px;
  font-size: 10px; font-weight: 750; letter-spacing: .03em;
  background: var(--accent-soft); color: var(--accent-ink);
}
.att-text { flex: 1; min-width: 0; display: grid; line-height: 1.3; }
.att-name { font-size: 13px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-size { font-size: 12px; color: var(--muted); }
.att > .icon { width: 16px; height: 16px; color: var(--faint); }
.att:hover > .icon { color: var(--accent); }

.paper {
  flex: 1; min-height: 360px; display: flex;
  background: #fff;
  border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.paper iframe { flex: 1; width: 100%; border: 0; background: #fff; }

/* ================= Dialogs ================= */
dialog { color: var(--text); }
.compose {
  width: min(600px, calc(100vw - 32px));
  margin: auto 28px 28px auto;
  padding: 0;
  border: 1px solid var(--border); border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}
.compose[open] { animation: rise .22s cubic-bezier(.2, .9, .3, 1.1); }
.compose::backdrop, .shortcuts::backdrop { background: rgba(8, 10, 18, .35); backdrop-filter: blur(2px); }
@keyframes rise { from { opacity: 0; transform: translateY(16px) scale(.98); } }
.compose form { display: flex; flex-direction: column; }
.compose-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 12px 20px; border-bottom: 1px solid var(--border); }
.compose-head h2 { font-size: 15px; font-weight: 650; }
.compose-fields { padding: 0 20px; }
.cf-row { display: flex; align-items: center; gap: 12px; min-height: 44px; border-bottom: 1px solid var(--border); }
.cf-label { width: 56px; flex: none; font-size: 13px; color: var(--muted); }
.cf-row input { flex: 1; min-width: 0; height: 42px; border: 0; background: transparent; font: inherit; font-size: 14px; color: var(--text); outline: none; }
.cf-row input::placeholder { color: var(--faint); }
.cf-row:focus-within .cf-label { color: var(--accent); }
.cf-static { font-size: 14px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compose textarea {
  min-height: 260px; max-height: 50vh; resize: vertical;
  margin: 0; padding: 16px 20px;
  border: 0; background: transparent; outline: none;
  font: inherit; font-size: 14.5px; line-height: 1.6; color: var(--text);
}
.compose textarea::placeholder { color: var(--faint); }
.compose .alert { margin: 0 20px 12px; }
.compose-foot { display: flex; align-items: center; gap: 12px; padding: 12px 12px 14px 20px; border-top: 1px solid var(--border); }
.compose-note { flex: 1; font-size: 12px; color: var(--faint); display: flex; align-items: center; gap: 3px; flex-wrap: wrap; }
.compose-note kbd { height: 18px; min-width: 18px; font-size: 10px; }

.shortcuts {
  width: min(420px, calc(100vw - 32px));
  padding: 0; border: 1px solid var(--border); border-radius: var(--r-lg);
  background: var(--surface); box-shadow: var(--shadow-lg);
}
.shortcuts[open] { animation: rise .2s ease-out; }
.shortcut-list { margin: 0; padding: 10px 20px 18px; display: grid; }
.shortcut-list div { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.shortcut-list div:last-child { border-bottom: 0; }
.shortcut-list dt { display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: 12px; }
.shortcut-list dd { margin: 0; font-size: 13.5px; }

/* ================= Toast ================= */
.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 50;
  display: flex; align-items: center; gap: 10px;
  max-width: calc(100vw - 32px);
  padding: 11px 16px 11px 13px; border-radius: 12px;
  background: #111827; color: #f9fafb;
  font-size: 13.5px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  transform: translateX(-50%);
  animation: toast-in .25s cubic-bezier(.2, .9, .3, 1.2);
}
.toast .icon { width: 18px; height: 18px; color: #4ade80; }
.toast.error .icon { color: #f87171; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 12px); } }

/* ================= Responsive ================= */
@media (max-width: 1180px) {
  .shell { grid-template-columns: 72px minmax(300px, 360px) 1fr; }
  .sidebar { align-items: center; padding: 14px 10px; }
  .side-brand span:not(.logo), .compose-btn span, .nav-label, .badge, .shortcut-hint, .me-text, .side-actions .btn span { display: none; }
  .side-brand { padding: 4px 0 14px; }
  .compose-btn { width: 44px; height: 44px; padding: 0; border-radius: 12px; }
  .nav-item { width: 44px; height: 40px; justify-content: center; padding: 0; position: relative; }
  .nav-item.has-unread::after { content: ""; position: absolute; top: 9px; right: 10px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
  .me { padding: 0; border: 0; background: transparent; }
  .side-actions { grid-template-columns: 1fr; }
  .side-actions .btn { width: 44px; justify-content: center; padding: 0; }
}

@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
  .auth-panel { place-items: start center; padding-top: 56px; }
  .auth-mobile-brand { display: flex; }
}

@media (max-width: 760px) {
  body { font-size: 15px; }
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .list-pane { border-right: 0; }
  .mobile-bar {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 10px 10px 14px;
    padding-top: max(10px, env(safe-area-inset-top));
    border-bottom: 1px solid var(--border);
  }
  .mobile-id { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
  .mobile-id strong { font-size: 15px; }
  .mobile-id span { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .list-title h1 { font-size: 18px; }
  .list-header { padding: 12px 14px 10px; }
  .list-title { margin-bottom: 10px; }
  .search kbd { display: none; }
  .message-list { padding-bottom: 92px; }
  .fab {
    display: grid; place-items: center;
    position: absolute; right: 18px; bottom: max(18px, env(safe-area-inset-bottom));
    width: 56px; height: 56px; border: 0; border-radius: 18px;
    background: var(--accent); color: #fff; cursor: pointer;
    box-shadow: 0 10px 30px rgba(79, 70, 229, .45);
  }
  .fab[hidden] { display: none !important; }
  .fab .icon { width: 22px; height: 22px; }

  .reader-pane { display: none; }
  .shell.reading .list-pane { display: none; }
  .shell.reading .reader-pane { display: flex; }
  .reader { padding: 8px 10px 12px; gap: 10px; }
  .back-btn { display: inline-grid; }
  .close-btn { display: none; }
  .reader-toolbar .btn span { display: none; }
  .reader-toolbar .btn { width: 36px; padding: 0; }
  .reader-head { padding: 16px; border-radius: 14px; }
  .reader-head h1 { font-size: 18px; margin-bottom: 14px; }
  .sender { flex-wrap: wrap; }
  .r-date { width: 100%; text-align: left; padding-left: 56px; margin-top: -4px; }
  .r-date span { display: inline; margin-left: 6px; }
  .att { width: 100%; }
  .paper { min-height: 60vh; border-radius: 14px; }

  .compose {
    width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh;
    margin: 0; border-radius: 0; border: 0;
  }
  .compose form { height: 100%; }
  .compose textarea { flex: 1; max-height: none; }
  .compose-note { display: none; }
  .compose-foot { justify-content: space-between; }
  .kbd-row, .shortcut-hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ================= Setup wizard ================= */
.auth-note { margin-top: 10px; text-align: center; font-size: 12.5px; color: var(--faint); }
.setup h2 { font-size: 26px; letter-spacing: -.03em; font-weight: 700; }
.setup .auth-sub strong { color: var(--text); font-weight: 600; }

.steps { list-style: none; display: flex; align-items: center; gap: 8px; padding: 0; margin: 0 0 28px; }
.steps li { display: flex; align-items: center; gap: 8px; color: var(--faint); font-size: 13px; font-weight: 550; }
.steps li:not(:last-child)::after { content: ""; width: 28px; height: 2px; border-radius: 2px; background: var(--border-strong); margin-left: 2px; }
.step-dot {
  display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  font-size: 12px; font-weight: 700;
  background: var(--hover); color: var(--muted); border: 1px solid var(--border-strong);
  transition: background .2s, color .2s, border-color .2s;
}
.steps li.active { color: var(--text); }
.steps li.active .step-dot { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 0 0 4px var(--ring); }
.steps li.done { color: var(--text-2); }
.steps li.done .step-dot { background: var(--accent-soft); border-color: transparent; color: var(--accent-ink); }
.steps li.done:not(:last-child)::after { background: var(--accent); }

.setup-loading { display: flex; align-items: center; gap: 10px; padding: 40px 0; color: var(--muted); }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--border-strong); border-top-color: var(--accent); animation: spin .8s linear infinite; }

.result-icon { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 18px; margin-bottom: 18px; }
.result-icon .icon { width: 28px; height: 28px; stroke-width: 2; }
.result-icon.success { background: rgba(22, 163, 74, .12); color: var(--success); }
.result-icon.danger { background: var(--danger-soft); color: var(--danger); }
#setup-invalid .btn, #setup-done .btn { margin-top: 24px; }

.id-chip {
  display: flex; align-items: center; gap: 8px; margin-top: 18px;
  padding: 10px 12px; border-radius: 12px;
  background: var(--accent-soft); color: var(--accent-ink); font-size: 13px;
}
.id-chip .icon { width: 16px; height: 16px; }
.id-chip strong { margin-left: auto; font-weight: 650; font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 13px; }

.strength { display: flex; align-items: center; gap: 10px; margin-top: 8px; min-height: 16px; }
.strength-bar { flex: 1; height: 5px; border-radius: 3px; background: var(--hover); overflow: hidden; }
#strength-fill { display: block; height: 100%; width: 0; border-radius: 3px; transition: width .25s, background .25s; }
#strength-fill.s1 { width: 25%; background: #ef4444; }
#strength-fill.s2 { width: 50%; background: #f59e0b; }
#strength-fill.s3 { width: 75%; background: #22c55e; }
#strength-fill.s4 { width: 100%; background: #16a34a; }
#strength-label { width: 48px; font-size: 12px; font-weight: 600; color: var(--muted); text-align: right; }

.rules { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 6px; }
.rules li { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); transition: color .2s; }
.rules .icon { width: 15px; height: 15px; padding: 2px; border-radius: 50%; background: var(--hover); color: transparent; stroke-width: 3; transition: background .2s, color .2s; }
.rules li.ok { color: var(--text-2); }
.rules li.ok .icon { background: var(--success); color: #fff; }
.setup .alert { margin-top: 16px; }
.setup .btn.lg { margin-top: 22px; }

.totp-steps { list-style: none; padding: 0; margin: 20px 0 0; display: grid; gap: 14px; }
.totp-steps li { display: flex; gap: 12px; align-items: flex-start; }
.totp-steps .num {
  display: grid; place-items: center; flex: none; width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent-ink); font-size: 12px; font-weight: 700;
}
.totp-steps strong { display: block; font-size: 14px; font-weight: 600; }
.totp-steps span:not(.num) { font-size: 13px; color: var(--muted); }
.qr-box {
  display: grid; place-items: center; margin: 16px 0 4px;
  padding: 16px; border-radius: 18px;
  background: #fff; border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.qr-box img { display: block; width: 196px; height: 196px; image-rendering: pixelated; }
.manual-key { margin-top: 10px; font-size: 13px; }
.manual-key summary { cursor: pointer; color: var(--accent); font-weight: 550; list-style: none; }
.manual-key summary::-webkit-details-marker { display: none; }
.manual-key summary::before { content: "›"; display: inline-block; margin-right: 6px; transition: transform .2s; }
.manual-key[open] summary::before { transform: rotate(90deg); }
.key-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.key-row code {
  flex: 1; min-width: 0; padding: 9px 12px; border-radius: 10px;
  background: var(--surface-2); border: 1px dashed var(--border-strong);
  font: 600 13px/1.4 ui-monospace, "SF Mono", Consolas, monospace; letter-spacing: .04em;
  overflow-wrap: anywhere;
}
#setup-otp { margin-top: 12px; }
.setup-back { margin-top: 8px; }

/* ================= Shared bits ================= */
.btn.danger { background: var(--danger); border-color: transparent; color: #fff; }
.btn.danger:hover { filter: brightness(1.08); background: var(--danger); }
.center { text-align: center; }

/* ================= Admin ================= */
.admin-shell { grid-template-columns: 248px 1fr; }
.admin-badge {
  margin-left: auto; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase;
  background: var(--accent-soft); color: var(--accent-ink);
}
.secure-note {
  display: flex; align-items: center; gap: 8px; margin-bottom: 8px;
  padding: 9px 10px; border-radius: 10px;
  font-size: 12px; color: var(--muted);
  background: var(--hover);
}
.secure-note .icon { width: 16px; height: 16px; }
.secure-note.on { background: rgba(22, 163, 74, .1); color: var(--success); }

.admin-main { min-width: 0; min-height: 0; overflow-y: auto; background: var(--bg); }
.admin-section { max-width: 1080px; margin: 0 auto; padding: 32px 32px 48px; display: grid; gap: 20px; }
.admin-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.admin-head h1 { font-size: 26px; font-weight: 700; letter-spacing: -.03em; }
.admin-head p { margin-top: 4px; color: var(--muted); max-width: 560px; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat {
  display: grid; gap: 4px; padding: 16px 18px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-sm);
}
.stat-label { font-size: 12.5px; color: var(--muted); font-weight: 550; }
.stat strong { font-size: 26px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-head h2 { font-size: 15px; font-weight: 650; }
.card-head p { margin-top: 2px; font-size: 13px; color: var(--muted); }
.search.sm { height: 34px; width: 240px; max-width: 100%; }

.suggest { border-style: dashed; border-color: var(--accent-soft-2); }
.suggest .card-head { border-bottom: 0; padding-bottom: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 6px 18px 18px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  height: 34px; padding: 0 12px 0 10px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface-2);
  font-size: 13px; font-weight: 550; cursor: pointer;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.chip .icon { width: 14px; height: 14px; color: var(--accent); }
.chip small { color: var(--faint); font-weight: 500; }
.chip:hover { border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--ring); }

.user-table { display: grid; }
.u-row {
  display: grid; align-items: center; gap: 16px;
  grid-template-columns: minmax(170px, 1.2fr) minmax(180px, 1.3fr) minmax(150px, 1fr) 110px auto;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  transition: background .12s;
}
.u-row:last-child { border-bottom: 0; }
.u-row:hover { background: var(--surface-2); }
.u-row.is-disabled .u-main, .u-row.is-disabled .u-alias { opacity: .55; }
.u-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.u-who { display: grid; min-width: 0; line-height: 1.3; }
.u-who strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.u-who span { font-size: 12.5px; color: var(--muted); font-family: ui-monospace, "SF Mono", Consolas, monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.u-alias { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13.5px; color: var(--text-2); }
.u-alias .icon { width: 15px; height: 15px; color: var(--faint); }
.u-alias span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.u-status { display: grid; justify-items: start; gap: 3px; }
.u-status small { font-size: 12px; color: var(--faint); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.ok { background: rgba(22, 163, 74, .12); color: var(--success); }
.pill.warn { background: rgba(245, 158, 11, .14); color: #b45309; }
.pill.bad { background: var(--danger-soft); color: var(--danger); }
.pill.muted { background: var(--hover); color: var(--muted); }
:root[data-theme="dark"] .pill.warn { color: #fbbf24; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .pill.warn { color: #fbbf24; } }
.u-send { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); cursor: pointer; }
.u-actions { display: flex; gap: 2px; justify-content: flex-end; }
.u-actions .icon-btn .icon { width: 17px; height: 17px; }
.icon-btn.danger-hover:hover { color: var(--danger); background: var(--danger-soft); }

.switch { position: relative; display: inline-block; width: 38px; height: 22px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.slider { position: absolute; inset: 0; border-radius: 999px; background: var(--border-strong); transition: background .2s; }
.slider::before { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s; }
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(16px); }
.switch input:focus-visible + .slider { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch input:disabled + .slider { opacity: .6; }

.activity { list-style: none; margin: 0; padding: 6px 0; }
.act { display: flex; gap: 14px; padding: 12px 18px; border-bottom: 1px solid var(--border); }
.act:last-child { border-bottom: 0; }
.act-dot { flex: none; width: 9px; height: 9px; margin-top: 6px; border-radius: 50%; background: var(--faint); box-shadow: 0 0 0 4px var(--hover); }
.act.ok .act-dot { background: var(--success); box-shadow: 0 0 0 4px rgba(22, 163, 74, .12); }
.act.bad .act-dot { background: var(--danger); box-shadow: 0 0 0 4px var(--danger-soft); }
.act.warn .act-dot { background: #f59e0b; box-shadow: 0 0 0 4px rgba(245, 158, 11, .14); }
.act.admin .act-dot { background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.act-body { min-width: 0; }
.act-line { font-size: 13.5px; color: var(--text-2); overflow-wrap: anywhere; }
.act-line strong { color: var(--text); font-weight: 600; }
.act-extra { color: var(--muted); }
.act-meta { margin-top: 2px; font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }
.activity-empty { padding: 32px; text-align: center; color: var(--muted); }

/* ================= Modals ================= */
.modal {
  width: min(520px, calc(100vw - 32px));
  padding: 0; border: 1px solid var(--border); border-radius: var(--r-lg);
  background: var(--surface); box-shadow: var(--shadow-lg);
}
.modal.small { width: min(400px, calc(100vw - 32px)); }
.modal[open] { animation: rise .2s ease-out; }
.modal::backdrop { background: rgba(8, 10, 18, .4); backdrop-filter: blur(3px); }
.modal-body { padding: 4px 20px 20px; }
.modal-body > .field:first-child { margin-top: 16px; }
.modal-body .alert { margin-top: 16px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-row .field { margin-top: 16px; }
.modal .input-wrap input { height: 42px; font-size: 14px; padding-right: 12px; }
.switch-row {
  display: flex; align-items: flex-start; gap: 12px; margin-top: 16px;
  padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); cursor: pointer;
}
.switch-row strong { display: block; font-size: 13.5px; font-weight: 600; }
.switch-row small { display: block; font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.switch-row .switch { margin-top: 2px; }

.link-hero { display: flex; gap: 14px; align-items: center; margin-top: 16px; }
.link-hero .result-icon { margin: 0; flex: none; width: 48px; height: 48px; border-radius: 14px; }
.link-hero .result-icon .icon { width: 22px; height: 22px; }
.link-hero p { font-size: 14px; color: var(--text-2); }
.link-box { display: flex; gap: 8px; margin-top: 18px; }
.link-box input {
  flex: 1; min-width: 0; height: 40px; padding: 0 12px;
  font: 500 12.5px/1 ui-monospace, "SF Mono", Consolas, monospace; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: 10px;
}
.link-box .btn { height: 40px; }
.link-meta { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 8px; }
.link-meta li { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--muted); }
.link-meta .icon { width: 16px; height: 16px; margin-top: 1px; color: var(--faint); }
.link-meta li.warn { color: #b45309; }
.link-meta li.warn .icon { color: #f59e0b; }
.stepup-icon { display: grid; place-items: center; width: 52px; height: 52px; margin: 16px auto 10px; border-radius: 16px; background: var(--accent-soft); color: var(--accent); }
.stepup-icon .icon { width: 26px; height: 26px; }
#stepup-otp { margin-top: 18px; }

/* ================= Admin responsive ================= */
@media (max-width: 1180px) {
  .admin-shell { grid-template-columns: 72px 1fr; }
  .admin-badge, .secure-note span { display: none; }
  .secure-note { justify-content: center; width: 44px; padding: 10px 0; }
  .u-row { grid-template-columns: minmax(150px, 1fr) minmax(160px, 1.2fr) minmax(130px, 1fr) auto; }
  .u-send > span:last-child { display: none; }
  .u-actions { grid-column: 1 / -1; justify-content: flex-start; margin-top: -6px; }
}
@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .admin-shell { grid-template-columns: 1fr; }
  .admin-main { display: flex; flex-direction: column; }
  .mobile-tab.active { color: var(--accent); background: var(--accent-soft); }
  .admin-section { padding: 18px 14px 40px; gap: 16px; }
  .admin-head h1 { font-size: 22px; }
  .admin-head .btn { width: 100%; }
  .stat { padding: 12px 14px; }
  .stat strong { font-size: 22px; }
  .search.sm { width: 100%; }
  .u-row { grid-template-columns: 1fr auto; gap: 10px 12px; padding: 14px; }
  .u-alias { grid-column: 1 / -1; order: 3; }
  .u-status { order: 2; justify-items: end; }
  .u-send { order: 4; }
  .u-send > span:last-child { display: inline; }
  .u-actions { order: 5; grid-column: auto; margin: 0; }
  .field-row { grid-template-columns: 1fr; gap: 0; }
  .steps .step-label { display: none; }
  .steps li.active .step-label { display: inline; }
}
