/* ============ design tokens ============ */
:root {
  color-scheme: dark;
  --bg: #08090d;
  --bg-soft: #0c0e14;
  --panel: #101219;
  --panel-2: #141722;
  --line: rgba(255, 255, 255, .07);
  --line-strong: rgba(255, 255, 255, .12);
  --text: #e9eaf0;
  --text-dim: #99a0b0;
  --text-faint: #6a7183;
  --accent: #8b5cf6;
  --accent-2: #6366f1;
  --accent-soft: rgba(139, 92, 246, .14);
  --ok: #34d399;
  --warn: #fbbf24;
  --danger: #f87171;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 20px 60px rgba(0, 0, 0, .45);
  --ease: cubic-bezier(.22, .61, .36, 1);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(900px 500px at 12% -10%, rgba(139, 92, 246, .16), transparent 60%),
    radial-gradient(700px 400px at 100% 0%, rgba(99, 102, 241, .10), transparent 55%),
    var(--bg);
  color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
::selection { background: rgba(139, 92, 246, .35); }

/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.14) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 8px; border: 3px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.2); background-clip: content-box; }

/* ============ buttons / fields ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: var(--radius-sm);
  font-weight: 600; font-size: 13.5px; letter-spacing: .01em;
  border: 1px solid transparent; transition: transform .12s var(--ease), background .16s, border-color .16s, opacity .16s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(180deg, #9a6bff, #7c4df0);
  color: #fff; box-shadow: 0 8px 24px rgba(124, 77, 240, .35), inset 0 1px 0 rgba(255,255,255,.18);
}
.btn-primary:hover { filter: brightness(1.06); }
.btn-primary:disabled { opacity: .55; box-shadow: none; cursor: default; }
.btn-ghost { background: var(--panel-2); border-color: var(--line); color: var(--text-dim); }
.btn-ghost:hover { color: var(--text); border-color: var(--line-strong); background: #171b26; }
.btn-small { height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 9px; }
.btn-block { width: 100%; }

.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px;
  border-radius: 9px; color: var(--text-dim); border: 1px solid transparent;
  transition: background .16s, color .16s, border-color .16s;
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { background: var(--panel-2); color: var(--text); border-color: var(--line); }
.icon-btn:active { transform: translateY(1px); }

.field { display: grid; gap: 7px; }
.field > span { font-size: 12px; color: var(--text-faint); font-weight: 600; letter-spacing: .02em; }
.field input, .field select, .modal textarea {
  width: 100%; height: 42px; padding: 0 13px; border-radius: var(--radius-sm);
  background: #0b0d13; border: 1px solid var(--line); color: var(--text);
  outline: none; transition: border-color .16s, box-shadow .16s, background .16s;
}
.field input:focus, .field select:focus, .modal textarea:focus {
  border-color: rgba(139, 92, 246, .6);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, .16);
  background: #0d1017;
}
.field-inline { min-width: 150px; }

/* ============ auth ============ */
.auth { position: fixed; inset: 0; display: grid; place-items: center; padding: 24px; }
.auth-glow {
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(600px 300px at 50% 20%, rgba(139, 92, 246, .18), transparent 70%);
}
.auth-card {
  position: relative; width: min(420px, 100%);
  background: linear-gradient(180deg, rgba(22, 25, 35, .92), rgba(14, 16, 23, .96));
  border: 1px solid var(--line); border-radius: 18px; padding: 28px;
  box-shadow: var(--shadow); backdrop-filter: blur(14px);
  animation: rise .4s var(--ease);
}
@keyframes rise { from { opacity: 0; transform: translateY(10px) scale(.99); } to { opacity: 1; transform: none; } }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.brand-mark { width: 30px; height: 30px; color: var(--accent); flex: none; }
.auth-title { font-size: 17px; font-weight: 700; letter-spacing: -.2px; }
.auth-sub { font-size: 12.5px; color: var(--text-faint); }

.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; background: #0a0c12; border: 1px solid var(--line); border-radius: 11px; margin-bottom: 20px; }
.tab { height: 34px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--text-faint); transition: .16s; }
.tab:hover { color: var(--text-dim); }
.tab.is-active { background: var(--panel-2); color: var(--text); box-shadow: 0 1px 0 rgba(255,255,255,.05) inset; }

.auth-form { display: grid; gap: 14px; }
.auth-error {
  margin: 0; padding: 10px 12px; border-radius: 9px; font-size: 12.5px;
  background: rgba(248, 113, 113, .1); border: 1px solid rgba(248, 113, 113, .28); color: #fca5a5;
}
.auth-meta { margin: 2px 0 0; font-size: 12px; color: var(--text-faint); text-align: center; }

/* ============ app shell ============ */
.app { position: fixed; inset: 0; display: flex; flex-direction: column; animation: fade .25s var(--ease); }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.topbar {
  height: 58px; flex: none; display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 0 16px; border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(16,18,25,.9), rgba(10,12,17,.75));
  backdrop-filter: blur(12px);
}
.topbar-left { display: flex; align-items: center; gap: 14px; min-width: 0; flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 10px; flex: none; }
.logo { display: flex; align-items: center; gap: 9px; font-weight: 700; letter-spacing: -.2px; white-space: nowrap; }
.logo .brand-mark { width: 22px; height: 22px; }

.search { position: relative; display: flex; align-items: center; gap: 8px; max-width: 380px; width: 100%; height: 36px; padding: 0 12px; border-radius: 10px; background: #0a0c12; border: 1px solid var(--line); transition: border-color .16s, box-shadow .16s; }
.search:focus-within { border-color: rgba(139,92,246,.5); box-shadow: 0 0 0 3px rgba(139,92,246,.13); }
.search svg { width: 16px; height: 16px; color: var(--text-faint); flex: none; }
.search input { flex: 1; min-width: 0; background: none; border: 0; outline: none; font-size: 13px; }
.search input::placeholder { color: var(--text-faint); }

.live { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 10px; border-radius: 99px; background: rgba(52, 211, 153, .08); border: 1px solid rgba(52, 211, 153, .2); font-size: 11.5px; color: #6ee7b7; }
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 rgba(52,211,153,.6); animation: pulse 2.4s infinite; }
.live.is-idle { background: var(--panel-2); border-color: var(--line); color: var(--text-faint); }
.live.is-idle .live-dot { background: var(--text-faint); animation: none; box-shadow: none; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(52,211,153,.5); }
  70% { box-shadow: 0 0 0 7px rgba(52,211,153,0); }
  100% { box-shadow: 0 0 0 0 rgba(52,211,153,0); }
}
.user { display: flex; align-items: center; gap: 4px; padding-left: 8px; border-left: 1px solid var(--line); }
.user-name { font-size: 12.5px; color: var(--text-dim); max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============ layout ============ */
.layout {
  flex: 1; min-height: 0; display: grid;
  grid-template-columns: 292px 372px minmax(0, 1fr);
  gap: 1px; background: var(--line);
}
.panel { background: var(--panel); min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.panel-head {
  flex: none; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px; border-bottom: 1px solid var(--line); min-height: 56px;
}
.panel-actions { display: flex; gap: 4px; }
.panel-foot { flex: none; padding: 10px 12px; border-top: 1px solid var(--line); font-size: 12px; color: var(--text-faint); }

/* ---- accounts ---- */
.filters { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px;
  border-radius: 99px; font-size: 12px; font-weight: 600; color: var(--text-faint);
  background: #0a0c12; border: 1px solid var(--line); white-space: nowrap; transition: .16s;
}
.chip b { font-weight: 700; color: var(--text-dim); font-size: 11px; }
.chip:hover { color: var(--text-dim); border-color: var(--line-strong); }
.chip.is-active { color: #fff; background: var(--accent-soft); border-color: rgba(139,92,246,.5); }
.chip.is-active b { color: #c4b5fd; }

.accounts-list { flex: 1; min-height: 0; overflow-y: auto; padding: 8px; display: grid; gap: 4px; align-content: start; }
.acc {
  display: grid; grid-template-columns: 8px minmax(0,1fr) auto; gap: 10px; align-items: center;
  padding: 10px 11px; border-radius: 11px; border: 1px solid transparent; transition: .14s var(--ease);
  text-align: left; width: 100%;
}
.acc:hover { background: var(--panel-2); border-color: var(--line); }
.acc.is-active { background: var(--accent-soft); border-color: rgba(139,92,246,.42); }
.acc-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-faint); }
.acc[data-status="work"] .acc-dot { background: var(--accent); box-shadow: 0 0 8px rgba(139,92,246,.7); }
.acc[data-status="new"] .acc-dot { background: #64748b; }
.acc[data-status="paused"] .acc-dot { background: var(--warn); }
.acc[data-status="done"] .acc-dot { background: var(--ok); }
.acc-copy { min-width: 0; }
.acc-email { font-size: 12.8px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-sub { font-size: 11.5px; color: var(--text-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-badge {
  min-width: 22px; height: 20px; padding: 0 6px; border-radius: 99px; display: grid; place-items: center;
  font-size: 11px; font-weight: 700; background: var(--accent); color: #fff;
}
.acc-badge.is-zero { background: transparent; color: var(--text-faint); font-weight: 600; }
.acc-error { color: var(--danger); font-size: 11px; }

/* ---- messages ---- */
.mailbox-title { min-width: 0; }
.mailbox-email { font-size: 13px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mailbox-meta { font-size: 11.5px; color: var(--text-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.msg-list { flex: 1; min-height: 0; overflow-y: auto; }
.msg {
  display: grid; gap: 4px; padding: 12px 14px; border-bottom: 1px solid var(--line);
  cursor: pointer; transition: background .14s; position: relative; text-align: left; width: 100%;
}
.msg:hover { background: var(--panel-2); }
.msg.is-active { background: var(--accent-soft); }
.msg.is-active::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: var(--accent); }
.msg-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.msg-from { font-size: 12.5px; font-weight: 600; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg.unseen .msg-from { color: var(--text); }
.msg-date { font-size: 11px; color: var(--text-faint); flex: none; }
.msg-subject { font-size: 13px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg.unseen .msg-subject { color: var(--text); font-weight: 600; }
.msg-unread-dot { position: absolute; left: 5px; top: 50%; transform: translateY(-50%); width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }

.empty { display: grid; place-items: center; gap: 10px; padding: 40px 20px; color: var(--text-faint); text-align: center; font-size: 13px; }
.empty svg { width: 34px; height: 34px; opacity: .5; }
.empty-error { color: var(--danger); font-size: 12.5px; max-width: 320px; }

/* skeletons */
.sk { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.sk-line { height: 10px; border-radius: 6px; background: linear-gradient(90deg, rgba(255,255,255,.05) 25%, rgba(255,255,255,.11) 37%, rgba(255,255,255,.05) 63%); background-size: 400% 100%; animation: shimmer 1.4s ease-in-out infinite; }
.sk-line + .sk-line { margin-top: 8px; }
.sk-line.w40 { width: 40%; }
.sk-line.w70 { width: 70%; }
.sk-line.w85 { width: 85%; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

/* ---- reader ---- */
.reader { position: relative; }
.reader-empty { position: absolute; inset: 0; display: grid; place-items: center; gap: 12px; color: var(--text-faint); text-align: center; padding: 30px; }
.reader-empty svg { width: 40px; height: 40px; opacity: .4; }
.reader-empty p { margin: 0; font-size: 13px; }
.reader-body { display: flex; flex-direction: column; min-height: 0; height: 100%; animation: fade .2s var(--ease); }
.reader-head { flex: none; display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.reader-titles { min-width: 0; flex: 1; }
.reader-titles h1 { margin: 0 0 4px; font-size: 15px; font-weight: 700; letter-spacing: -.2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reader-sub { font-size: 12px; color: var(--text-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reader-links { flex: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: #0b0d13; max-height: 116px; overflow-y: auto; }
.link-chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 8px; font-size: 11.5px; font-weight: 600; border: 1px solid var(--line); background: var(--panel-2); color: var(--text-dim); max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-chip:hover { color: #fff; border-color: rgba(139,92,246,.5); background: var(--accent-soft); text-decoration: none; }
.link-chip[data-kind="confirm"] { border-color: rgba(52,211,153,.35); color: #6ee7b7; }
.link-chip[data-kind="reset"] { border-color: rgba(251,191,36,.3); color: #fcd34d; }
.link-chip[data-kind="login"] { border-color: rgba(96,165,250,.3); color: #93c5fd; }
.reader-frame { flex: 1; min-height: 0; width: 100%; border: 0; background: #fff; }

/* ============ modal ============ */
.modal { position: fixed; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(4, 5, 8, .7); backdrop-filter: blur(6px); z-index: 50; animation: fade .18s var(--ease); }
.modal-card { width: min(560px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 20px; box-shadow: var(--shadow); display: grid; gap: 14px; animation: rise .22s var(--ease); }
.modal-head { display: flex; align-items: center; justify-content: space-between; }
.modal-head h2 { margin: 0; font-size: 16px; letter-spacing: -.2px; }
.modal-hint { margin: 0; font-size: 12.5px; color: var(--text-faint); }
.modal-hint code { background: #0a0c12; border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; font-size: 11.5px; }
.modal textarea { height: auto; min-height: 150px; padding: 12px 13px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; line-height: 1.6; }
.modal-row { display: flex; gap: 12px; flex-wrap: wrap; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; }

/* ============ toasts ============ */
.toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 60; }
.toast {
  min-width: 220px; max-width: 360px; padding: 11px 13px; border-radius: 11px; font-size: 12.5px;
  background: #151925; border: 1px solid var(--line-strong); box-shadow: var(--shadow);
  animation: toastIn .2s var(--ease);
}
.toast.is-ok { border-color: rgba(52,211,153,.35); }
.toast.is-err { border-color: rgba(248,113,113,.4); color: #fca5a5; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ============ responsive ============ */
.only-mobile { display: none; }

@media (max-width: 1180px) {
  .layout { grid-template-columns: 262px minmax(0, 1fr); }
  .reader {
    position: fixed; inset: 0 0 0 auto; width: min(720px, 100%); z-index: 40;
    transform: translateX(100%); transition: transform .26s var(--ease);
    box-shadow: -20px 0 60px rgba(0,0,0,.5); border-left: 1px solid var(--line);
  }
  body.show-reader .reader { transform: none; }
  body.show-reader::after { content: ""; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 39; }
  .only-mobile { display: inline-grid; }
}

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .accounts {
    position: fixed; inset: 0 auto 0 0; width: min(320px, 86vw); z-index: 41;
    transform: translateX(-100%); transition: transform .26s var(--ease);
    box-shadow: 20px 0 60px rgba(0,0,0,.5); border-right: 1px solid var(--line);
  }
  body.show-accounts .accounts { transform: none; }
  body.show-accounts::after { content: ""; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 40; }
  .search { max-width: none; }
  .logo span { display: none; }
  .user-name { display: none; }
  .live-text { display: none; }
  .live { padding: 0 8px; }
  .reader { width: 100%; }
}

@media (max-width: 560px) {
  .topbar { padding: 0 10px; gap: 8px; }
  .panel-head { padding: 8px 10px; min-height: 52px; }
  .msg { padding: 11px 12px; }
  .reader-head { padding: 12px; flex-wrap: wrap; }
  .reader-titles h1 { white-space: normal; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* status selector in the messages header */
.status-select {
  height: 30px; padding: 0 8px; border-radius: 9px; font-size: 12px; font-weight: 600;
  background: #0a0c12; border: 1px solid var(--line); color: var(--text-dim);
  outline: none; transition: .16s; cursor: pointer;
}
.status-select:hover { color: var(--text); border-color: var(--line-strong); }
.status-select:focus { border-color: rgba(139,92,246,.55); box-shadow: 0 0 0 3px rgba(139,92,246,.14); }
.status-select[data-status="work"] { color: #c4b5fd; border-color: rgba(139,92,246,.5); background: var(--accent-soft); }
.status-select[data-status="done"] { color: #6ee7b7; border-color: rgba(52,211,153,.4); background: rgba(52,211,153,.08); }
.status-select[data-status="paused"] { color: #fcd34d; border-color: rgba(251,191,36,.35); background: rgba(251,191,36,.08); }
.is-loading .acc-copy { opacity: .55; }
.spin { animation: spin 900ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* the hidden attribute must win over the layout display rules above */
[hidden] { display: none !important; }

/* accounts header: chips wrap onto several rows instead of clipping */
.accounts-head { padding-bottom: 10px; }
.accounts-head .filters { flex-wrap: wrap; overflow: visible; row-gap: 6px; }
.chip-add { border-style: dashed; color: var(--text-dim); }
.chip-add:hover { color: #fff; border-color: rgba(139,92,246,.6); background: var(--accent-soft); }

/* ============ take bar ============ */
.take-bar {
  flex: none; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px; border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(139,92,246,.08), rgba(139,92,246,0));
}
.take-info { display: flex; flex-direction: column; line-height: 1.15; }
.take-label { font-size: 10.5px; color: var(--text-faint); text-transform: uppercase; letter-spacing: .06em; }
.take-count { font-size: 19px; font-weight: 700; }
.btn.is-empty { opacity: .7; }

/* ============ account row extras ============ */
.acc { position: relative; grid-template-columns: 10px 8px minmax(0, 1fr) auto; }
.acc-grip { opacity: 0; font-size: 13px; line-height: 1; color: var(--text-faint); cursor: grab; user-select: none; }
.acc:hover .acc-grip { opacity: .7; }
.acc.is-pinned { background: rgba(139,92,246,.05); }
.acc.is-dragging { opacity: .45; }
.acc.is-over { box-shadow: inset 0 2px 0 var(--accent); }
.acc-actions {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  display: none; gap: 2px; padding: 2px; border-radius: 8px;
  background: var(--panel-2); border: 1px solid var(--line);
}
.acc:hover .acc-actions { display: flex; }
.acc:hover .acc-badge { visibility: hidden; }
.row-btn { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 6px; color: var(--text-dim); }
.row-btn svg { width: 14px; height: 14px; }
.row-btn:hover { background: #1d2331; color: #fff; }
.row-btn.danger:hover { color: #f87171; }
.pin { width: 11px; height: 11px; margin-inline-end: 4px; color: var(--accent); vertical-align: -1px; }

/* ============ bell + role ============ */
.bell { position: relative; }
.bell-badge {
  position: absolute; top: 1px; right: 1px; min-width: 15px; height: 15px; padding: 0 4px;
  border-radius: 99px; background: var(--danger); color: #fff;
  font-size: 9.5px; font-weight: 700; display: grid; place-items: center;
}
.role-chip {
  font-size: 10px; padding: 2px 7px; border-radius: 99px; margin-inline-start: 6px;
  background: var(--accent-soft); border: 1px solid rgba(139,92,246,.5); color: #c4b5fd;
  text-transform: uppercase; letter-spacing: .05em;
}

/* ============ dropdown ============ */
.dropdown {
  position: absolute; top: 58px; right: 14px; width: 344px; max-width: calc(100vw - 24px);
  background: var(--panel); border: 1px solid var(--line-strong); border-radius: 13px;
  box-shadow: var(--shadow); z-index: 45; overflow: hidden; animation: rise .16s var(--ease);
}
.dropdown-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 12.5px; font-weight: 600; }
.dropdown-body { max-height: 330px; overflow-y: auto; }
.drop-item { padding: 10px 12px; border-bottom: 1px solid var(--line); }
.drop-item.is-unread { background: rgba(139,92,246,.08); }
.drop-text { font-size: 12.5px; line-height: 1.45; }
.drop-time { font-size: 11px; color: var(--text-faint); margin-top: 3px; }
.dropdown-empty { padding: 20px 12px; text-align: center; color: var(--text-faint); font-size: 12.5px; }

/* ============ admin modal ============ */
.modal-wide { width: min(880px, 100%); }
.admin-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stat { background: #0b0d13; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: grid; gap: 2px; }
.stat b { font-size: 18px; letter-spacing: -.3px; }
.stat span { font-size: 11px; color: var(--text-faint); }
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.admin-col h3 { margin: 0 0 8px; font-size: 13px; color: var(--text-dim); font-weight: 600; }
.admin-note { margin: 0 0 10px; font-size: 12px; color: var(--text-faint); }
.admin-list { display: grid; gap: 6px; max-height: 250px; overflow-y: auto; }
.admin-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: #0b0d13; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.admin-row-main { display: grid; gap: 2px; min-width: 0; }
.admin-row-main b { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-sub { font-size: 11px; color: var(--text-faint); }
.admin-row-actions { display: flex; gap: 4px; align-items: center; flex: none; }
.admin-form { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.admin-form input, .admin-form select, .mini-input {
  height: 32px; padding: 0 9px; border-radius: 8px; background: #0b0d13;
  border: 1px solid var(--line); color: var(--text); font-size: 12px; outline: none;
}
.admin-form input:focus, .admin-form select:focus, .mini-input:focus { border-color: rgba(139,92,246,.5); }
.admin-form input { width: 118px; }
.mini-input { width: 62px; }
.btn-small.danger { color: #f87171; border-color: rgba(248,113,113,.28); }

@media (max-width: 760px) {
  .admin-grid { grid-template-columns: 1fr; }
  .admin-stats { grid-template-columns: repeat(2, 1fr); }
  .acc-actions { position: static; transform: none; display: flex; border: 0; background: none; padding: 0; }
  .acc:hover .acc-badge { visibility: visible; }
  .acc { grid-template-columns: 8px minmax(0, 1fr) auto auto; }
  .acc-grip { display: none; }
}

/* ---------- take bar: stack so nothing bleeds into the next panel ---------- */
.accounts { overflow: hidden; }
.take-bar { flex-direction: column; align-items: stretch; gap: 8px; }
.take-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.take-row .btn { flex: 0 0 auto; }

/* ---------- copy affordances on mailbox rows ---------- */
.acc-email { display: flex; align-items: center; cursor: copy; }
.acc-email:hover { color: #fff; }
.copy-mini { width: 11px; height: 11px; margin-inline-start: 5px; flex: none; opacity: 0; color: var(--text-faint); }
.acc:hover .copy-mini { opacity: .75; }
.acc-email:hover .copy-mini { color: var(--accent); opacity: 1; }

/* ---------- credentials chip in the admin panel ---------- */
.cred {
  display: inline-block; margin-top: 4px; padding: 3px 8px; max-width: 100%;
  border-radius: 6px; background: #0b0d13; border: 1px dashed var(--line-strong);
  color: #c4b5fd; font: 11.5px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
  cursor: copy; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  transition: border-color .15s, color .15s;
}
.cred:hover { border-color: rgba(139,92,246,.65); color: #fff; }
.cred.is-empty { color: var(--text-faint); cursor: default; border-style: solid; font-family: inherit; font-size: 11px; }
.btn-block { width: 100%; }

/* ---------- hint under the mailbox list ---------- */
.foot-hint {
  flex: none; padding: 6px 12px 0; font-size: 10.5px; line-height: 1.4;
  color: #5c6478; letter-spacing: .01em;
}

/* ---------- copy icon is always discoverable ---------- */
.copy-mini { opacity: .5; }
.acc:hover .copy-mini { opacity: .9; }
.acc-email:hover .copy-mini { color: var(--accent); opacity: 1; }

/* ---------- admin rows: stack so credentials fit ---------- */
.admin-row { flex-direction: column; align-items: stretch; gap: 7px; }
.admin-row-main { gap: 3px; }
.admin-row-actions { flex-wrap: wrap; }
.admin-row-actions .btn { flex: 0 0 auto; }
.cred { align-self: flex-start; max-width: 100%; }
.admin-list { max-height: 300px; }

/* chips size to their content instead of stretching like inputs */
.admin-row-main { justify-items: start; }
.cred.is-empty {
  border: 0; padding: 0; background: none; color: #6b7280;
  font-size: 11px; font-style: italic; cursor: default;
}

/* ---------- link chips above the message: copy + open ---------- */
.reader-links { gap: 8px; padding: 12px 16px; max-height: 152px; align-content: flex-start; }
.reader-links::before {
  content: 'ссылки из письма'; flex: 0 0 100%; margin-bottom: 2px;
  font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: #5c6478;
}
.link-chip {
  display: inline-flex; align-items: center; gap: 0; height: 30px; padding: 0;
  border-radius: 9px; border: 1px solid var(--line-strong); background: #12141c;
  max-width: 100%; overflow: hidden; white-space: nowrap; font-size: 11.5px; font-weight: 600;
  transition: border-color .15s, box-shadow .15s;
}
.link-chip:hover { border-color: rgba(139,92,246,.6); box-shadow: 0 2px 10px rgba(0,0,0,.35); }
.lc-kind {
  flex: none; height: 100%; padding: 0 8px; display: inline-flex; align-items: center;
  font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  background: rgba(139,92,246,.16); color: #c4b5fd; border-right: 1px solid var(--line);
}
.lc-text {
  padding: 0 10px; max-width: 230px; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; color: var(--text-dim); cursor: copy;
}
.link-chip:hover .lc-text { color: #fff; }
.lc-btn {
  flex: none; width: 28px; height: 100%; display: grid; place-items: center;
  color: var(--text-faint); border-left: 1px solid var(--line);
}
.lc-btn svg { width: 13px; height: 13px; }
.lc-btn:hover { background: var(--accent-soft); color: #fff; }
.lc-btn.is-done { background: rgba(52,211,153,.22); color: #6ee7b7; }
.link-chip.is-copied { border-color: rgba(52,211,153,.6); }

.link-chip[data-kind="confirm"] .lc-kind { background: rgba(52,211,153,.18); color: #6ee7b7; }
.link-chip[data-kind="reset"] .lc-kind   { background: rgba(251,191,36,.16); color: #fcd34d; }
.link-chip[data-kind="login"] .lc-kind   { background: rgba(96,165,250,.16); color: #93c5fd; }
.link-chip[data-kind="order"] .lc-kind   { background: rgba(244,114,182,.16); color: #f9a8d4; }

/* neutral link kind + unsubscribe */
.link-chip[data-kind="link"] .lc-kind,
.link-chip[data-kind="other"] .lc-kind { background: rgba(148,163,184,.16); color: #cbd5e1; }
.link-chip[data-kind="unsubscribe"] .lc-kind { background: rgba(148,163,184,.12); color: #94a3b8; }

/* toasts stay compact even for very long urls */
.toast { max-width: 380px; word-break: break-word; overflow-wrap: anywhere; }

/* ---------- mailbox header: click to copy ---------- */
.mailbox-line { display: flex; align-items: center; gap: 6px; min-width: 0; }
.mailbox-email {
  padding: 0; background: none; border: 0; color: var(--text); cursor: copy;
  font: inherit; font-weight: 600; font-size: 13.5px;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mailbox-email:hover { color: var(--accent); }
.mailbox-email:disabled { cursor: default; color: var(--text-dim); }
.icon-mini { width: 24px; height: 24px; border-radius: 6px; }
.icon-mini svg { width: 13px; height: 13px; }

/* ---------- status is explicit in every row ---------- */
.acc-status { font-weight: 600; }
.acc-status[data-status="new"]    { color: #a5b4fc; }
.acc-status[data-status="work"]   { color: #6ee7b7; }
.acc-status[data-status="paused"] { color: #fcd34d; }
.acc-status[data-status="done"]   { color: #94a3b8; }

/* ---------- install button in the top bar ---------- */
.install-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px;
  border-radius: 9px; font-size: 12px; font-weight: 600;
  border: 1px solid rgba(139,92,246,.45);
  background: linear-gradient(180deg, rgba(139,92,246,.20), rgba(139,92,246,.10));
  color: #d7ccff; white-space: nowrap;
}
.install-btn svg { width: 14px; height: 14px; }
.install-btn:hover { border-color: rgba(167,139,250,.8); color: #fff; background: linear-gradient(180deg, rgba(139,92,246,.32), rgba(139,92,246,.18)); }
@media (max-width: 720px) { .install-btn span { display: none; } .install-btn { padding: 0 8px; } }

/* ---------- token verification badges ---------- */
.vf { font-weight: 700; font-size: 10.5px; }
.vf-ok { color: #34d399; }
.vf-fail { color: #f87171; }
.vf-wait { color: #fbbf24; animation: vfPulse 1.1s ease-in-out infinite; }
@keyframes vfPulse { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
