:root {
  --bg: #f4f5fb;
  --panel: #ffffff;
  --line: #e7e8f0;
  --line-soft: #f0f1f6;
  --text: #0f1222;
  --text-2: #3d4257;
  --muted: #6b7088;
  --accent: #5b5bf0;
  --accent-2: #8b5cf6;
  --accent-weak: #eef0ff;
  --grad: linear-gradient(135deg, #5b5bf0 0%, #8b5cf6 100%);
  --side: #0e1124;
  --side-2: #171b36;
  --side-text: #c7cbe3;
  --side-muted: #7d83a8;
  --ok: #0f8a4b; --ok-bg: #e7f7ee;
  --warn: #b25e00; --warn-bg: #fff4e0;
  --danger: #d0302f; --danger-bg: #fdeceb;
  --radius: 14px;
  --shadow-sm: 0 1px 2px rgba(16, 18, 40, .06);
  --shadow: 0 1px 3px rgba(16, 18, 40, .06), 0 8px 24px rgba(16, 18, 40, .06);
  --shadow-lg: 0 24px 60px rgba(16, 18, 40, .22);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); font-size: 14px; }
button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; padding: 0; }
input, textarea, select { font: inherit; color: inherit; }
a { color: var(--accent); }
.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.i.sm { width: 15px; height: 15px; }
.i.lg { width: 22px; height: 22px; }
.boot { display: grid; place-items: center; height: 100vh; color: var(--muted); }

/* ------------------------------------------------------------------ login */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; background: #fff; }
.login-hero { position: relative; overflow: hidden; background: radial-gradient(1200px 600px at -10% -10%, #7c6cff 0%, transparent 55%), radial-gradient(900px 500px at 110% 110%, #a855f7 0%, transparent 50%), #0e1124; color: #fff; padding: 56px; display: flex; flex-direction: column; }
.login-hero::after { content: ""; position: absolute; inset: 0; background-image: radial-gradient(rgba(255,255,255,.08) 1px, transparent 1px); background-size: 22px 22px; mask-image: linear-gradient(180deg, transparent, #000 30%, #000 70%, transparent); pointer-events: none; }
.login-hero .brand { color: #fff; }
.hero-copy { margin-top: auto; position: relative; z-index: 1; max-width: 460px; }
.hero-copy h2 { font-size: 40px; line-height: 1.1; letter-spacing: -.02em; margin: 0 0 16px; font-weight: 700; }
.hero-copy h2 span { background: linear-gradient(90deg, #c4b5fd, #f0abfc); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-copy p { color: #c7cbe3; font-size: 16px; line-height: 1.6; margin: 0 0 28px; }
.feat { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 14px; color: #dfe2f5; }
.feat .dot { width: 30px; height: 30px; border-radius: 9px; background: rgba(255,255,255,.1); display: grid; place-items: center; flex: none; border: 1px solid rgba(255,255,255,.12); }
.feat b { display: block; color: #fff; font-weight: 600; margin-bottom: 2px; }
.feat span { color: #a9aed0; font-size: 13px; }
.hero-foot { margin-top: 36px; color: #7d83a8; font-size: 12px; position: relative; z-index: 1; }
.login-form-wrap { display: grid; place-items: center; padding: 40px 24px; }
.login-card { width: 100%; max-width: 380px; }
.login-card h1 { font-size: 28px; margin: 0 0 8px; font-weight: 700; letter-spacing: -.02em; }
.login-card p.lead { color: var(--muted); margin: 0 0 28px; line-height: 1.55; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; letter-spacing: -.01em; }
.logo { width: 32px; height: 32px; border-radius: 10px; background: var(--grad); display: grid; place-items: center; color: #fff; box-shadow: 0 6px 16px rgba(91, 91, 240, .35); flex: none; }
.logo .i { width: 17px; height: 17px; }
.field { display: grid; gap: 7px; margin-bottom: 16px; }
.field label { font-size: 13px; color: var(--text-2); font-weight: 600; }
.input { width: 100%; padding: 12px 14px; border: 1px solid #dcdfea; border-radius: 10px; background: #fff; outline: none; transition: border-color .15s, box-shadow .15s; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-weak); }
.input-icon { position: relative; }
.input-icon .i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.input-icon .input { padding-left: 40px; }
.otp-input { letter-spacing: .45em; font-size: 24px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; padding: 14px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; border-radius: 10px; font-weight: 600; transition: background .15s, box-shadow .15s, transform .05s; white-space: nowrap; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 6px 16px rgba(91, 91, 240, .28); }
.btn-primary:hover { box-shadow: 0 8px 22px rgba(91, 91, 240, .4); }
.btn-primary:disabled { opacity: .6; cursor: default; box-shadow: none; }
.btn-ghost { border: 1px solid var(--line); background: #fff; color: var(--text-2); }
.btn-ghost:hover { background: #f7f8fc; border-color: #d9dbe7; }
.btn-soft { background: var(--accent-weak); color: var(--accent); }
.btn-soft:hover { background: #e3e6ff; }
.btn-danger { color: var(--danger); border: 1px solid #f5cdcc; background: #fff; }
.btn-danger:hover { background: var(--danger-bg); }
.btn-block { width: 100%; padding: 13px; font-size: 15px; }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 8px; }
.err { color: var(--danger); font-size: 13px; margin: 2px 0 12px; min-height: 18px; }
.secnote { margin-top: 26px; font-size: 12.5px; color: var(--muted); display: flex; gap: 8px; align-items: center; padding: 12px 14px; background: #f7f8fc; border-radius: 10px; border: 1px solid var(--line-soft); }
.linkbtn { color: var(--accent); font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.linkbtn:hover { text-decoration: underline; }

/* ------------------------------------------------------------------ shell */
.shell { display: grid; grid-template-columns: 264px 1fr; height: 100vh; }
.side { background: var(--side); color: var(--side-text); display: flex; flex-direction: column; min-height: 0; }
.side-top { padding: 20px 18px 8px; }
.side .brand { color: #fff; margin-bottom: 20px; }
.compose-btn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; padding: 12px; border-radius: 12px; font-weight: 600; background: var(--grad); color: #fff; box-shadow: 0 8px 20px rgba(91, 91, 240, .35); }
.compose-btn:hover { box-shadow: 0 10px 26px rgba(91, 91, 240, .5); }
.side-scroll { overflow-y: auto; padding: 10px 12px 16px; flex: 1; min-height: 0; }
.side-scroll::-webkit-scrollbar { width: 8px; }
.side-scroll::-webkit-scrollbar-thumb { background: #262b4d; border-radius: 8px; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 0 12px; height: 38px; border-radius: 10px; width: 100%; text-align: left; white-space: nowrap; overflow: hidden; color: var(--side-text); font-weight: 500; transition: background .12s, color .12s; }
.nav-item:hover { background: var(--side-2); color: #fff; }
.nav-item.active { background: rgba(124, 108, 255, .18); color: #fff; box-shadow: inset 3px 0 0 #8b7bff; }
.nav-item .i { color: var(--side-muted); }
.nav-item.active .i, .nav-item:hover .i { color: #b4abff; }
.nav-item .cnt { margin-left: auto; font-size: 11.5px; font-weight: 700; background: #7c6cff; color: #fff; border-radius: 10px; padding: 1px 7px; min-width: 20px; text-align: center; }
.side h4 { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--side-muted); margin: 22px 4px 10px 12px; display: flex; align-items: center; justify-content: space-between; font-weight: 700; }
.side h4 button { color: #b4abff; display: inline-flex; align-items: center; gap: 4px; font-size: 12px; letter-spacing: 0; text-transform: none; font-weight: 600; padding: 3px 8px; border-radius: 7px; }
.side h4 button:hover { background: var(--side-2); }
.mb-filter { margin: 0 0 8px; width: 100%; padding: 8px 12px; border: 1px solid #262b4d; border-radius: 9px; background: #12162e; color: #fff; font-size: 13px; outline: none; }
.mb-filter::placeholder { color: var(--side-muted); }
.mb-filter:focus { border-color: #5b5bf0; }
.mb-item { height: 34px; font-size: 13px; gap: 10px; }
.mb-dot { width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; font-size: 11px; font-weight: 700; color: #fff; flex: none; }
.mb-item .addr { overflow: hidden; text-overflow: ellipsis; }
.side-foot { border-top: 1px solid #1d2142; padding: 12px 14px; display: flex; align-items: center; gap: 10px; }
.side-foot .who { min-width: 0; flex: 1; line-height: 1.25; }
.side-foot .who b { display: block; color: #fff; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-foot .who span { color: var(--side-muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.side-foot .iconbtn { color: var(--side-muted); }
.side-foot .iconbtn:hover { background: var(--side-2); color: #fff; }

.content { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar { display: flex; align-items: center; gap: 16px; padding: 14px 24px; }
.search { flex: 1; max-width: 640px; display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 0 14px; height: 44px; box-shadow: var(--shadow-sm); color: var(--muted); transition: box-shadow .15s, border-color .15s; }
.search input { flex: 1; border: 0; background: transparent; outline: none; font-size: 14.5px; color: var(--text); }
.search:focus-within { border-color: #c9ccff; box-shadow: 0 0 0 4px var(--accent-weak); }
.kbd { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; background: #fafbfe; }
.topbar .spacer { flex: 1; }
.pill-status { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-2); background: #fff; border: 1px solid var(--line); padding: 7px 12px; border-radius: 20px; }
.pill-status .live { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, .2); }
.main { background: var(--panel); margin: 0 24px 24px; border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line); overflow: hidden; display: flex; flex-direction: column; min-height: 0; flex: 1; }
.avatar { width: 36px; height: 36px; border-radius: 50%; color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 14px; flex: none; }

/* ------------------------------------------------------------------ toolbars & lists */
.toolbar { display: flex; align-items: center; gap: 8px; padding: 14px 20px; border-bottom: 1px solid var(--line); min-height: 64px; }
.toolbar .title { font-weight: 700; font-size: 17px; letter-spacing: -.01em; margin-right: 6px; }
.toolbar .sub { color: var(--muted); font-size: 13px; }
.toolbar .spacer { flex: 1; }
.iconbtn { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: var(--text-2); transition: background .12s; }
.iconbtn:hover { background: #f1f2f8; }
.folders { display: flex; gap: 4px; padding: 10px 16px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.folder-tab { display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; color: var(--muted); border-radius: 9px; font-weight: 600; font-size: 13px; white-space: nowrap; }
.folder-tab:hover { background: #f4f5fa; color: var(--text-2); }
.folder-tab.active { color: var(--accent); background: var(--accent-weak); }
.folder-tab .i { width: 15px; height: 15px; }
.list { overflow-y: auto; flex: 1; }
.row { display: grid; grid-template-columns: 22px 36px 190px minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 0 20px; height: 62px; border-bottom: 1px solid var(--line-soft); cursor: pointer; transition: background .1s; position: relative; }
.row:hover { background: #f8f8fd; }
.row.unread::before { content: ""; position: absolute; left: 6px; top: 50%; width: 6px; height: 6px; margin-top: -3px; border-radius: 50%; background: var(--accent); }
.row .from { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.row.unread .from { font-weight: 700; color: var(--text); }
.row .mid { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.row .subj { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; gap: 8px; align-items: center; color: var(--text-2); }
.row.unread .subj { font-weight: 650; color: var(--text); }
.row .snip { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .right { display: flex; align-items: center; gap: 10px; }
.row .date { font-size: 12.5px; color: var(--muted); white-space: nowrap; min-width: 54px; text-align: right; }
.row.unread .date { color: var(--accent); font-weight: 650; }
.star { color: #c9cbd8; display: grid; place-items: center; }
.star:hover { color: #f5b301; }
.star.on { color: #f5b301; }
.star.on .i { fill: #f5b301; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 7px; font-size: 12px; font-weight: 650; white-space: nowrap; }
.chip .i { width: 13px; height: 13px; }
.chip.otp { background: var(--ok-bg); color: var(--ok); font-variant-numeric: tabular-nums; letter-spacing: .05em; border: 1px solid #c6ecd6; cursor: copy; }
.chip.otp:hover { background: #d9f3e4; }
.chip.mb { background: #f1f2f8; color: var(--text-2); font-weight: 600; }
.chip.st-queued, .chip.st-sent, .chip.st-delayed { background: var(--warn-bg); color: var(--warn); }
.chip.st-delivered { background: var(--ok-bg); color: var(--ok); }
.chip.st-bounced, .chip.st-failed, .chip.st-rejected, .chip.st-complaint { background: var(--danger-bg); color: var(--danger); }
.empty { padding: 70px 20px; text-align: center; color: var(--muted); }
.empty .ill { width: 64px; height: 64px; border-radius: 18px; background: var(--accent-weak); color: var(--accent); display: grid; place-items: center; margin: 0 auto 16px; }
.empty .ill .i { width: 28px; height: 28px; }
.empty h3 { color: var(--text); margin: 0 0 6px; font-size: 16px; }
.more { padding: 16px; text-align: center; }

/* ------------------------------------------------------------------ dashboard */
.page { overflow-y: auto; flex: 1; padding: 24px 28px 40px; }
.hello h1 { font-size: 26px; letter-spacing: -.02em; margin: 0 0 4px; font-weight: 700; }
.hello p { color: var(--muted); margin: 0; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin: 22px 0 28px; }
.stat { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: flex; gap: 14px; align-items: center; background: #fff; transition: box-shadow .15s, transform .15s; }
.stat:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.stat .ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.stat .n { font-size: 24px; font-weight: 750; letter-spacing: -.02em; line-height: 1.1; }
.stat .l { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.stat .n.small { font-size: 15px; font-weight: 700; }
.ico.indigo { background: #eef0ff; color: #5b5bf0; }
.ico.violet { background: #f3edff; color: #8b5cf6; }
.ico.green { background: #e7f7ee; color: #0f8a4b; }
.ico.amber { background: #fff4e0; color: #c26a00; }
.section-h { display: flex; align-items: center; justify-content: space-between; margin: 0 0 12px; }
.section-h h2 { font-size: 15px; font-weight: 700; margin: 0; display: flex; align-items: center; gap: 8px; }
.section-h .sub { color: var(--muted); font-size: 13px; font-weight: 500; }
.otp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; margin-bottom: 30px; }
.otp-card { position: relative; border-radius: var(--radius); padding: 16px 16px 14px; background: linear-gradient(180deg, #fbfbff 0%, #fff 100%); border: 1px solid var(--line); cursor: pointer; transition: box-shadow .15s, transform .15s, border-color .15s; overflow: hidden; }
.otp-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--grad); }
.otp-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); border-color: #d9dcff; }
.otp-card .top { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.otp-card .src { font-weight: 650; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.otp-card .t { color: var(--muted); font-size: 12px; white-space: nowrap; }
.otp-card .code { font-size: 28px; font-weight: 750; letter-spacing: .14em; font-variant-numeric: tabular-nums; font-family: ui-monospace, "SF Mono", Menlo, monospace; color: #1f1d5c; margin: 2px 0 10px; }
.otp-card .bot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.otp-card .to { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-list { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.card-list .row:last-child { border-bottom: 0; }

/* ------------------------------------------------------------------ reader */
.reader { overflow-y: auto; flex: 1; padding: 8px 0 48px; background: #fff; }
.reader-head { padding: 22px 32px 6px 32px; }
.reader-head h2 { font-size: 22px; font-weight: 700; margin: 0; letter-spacing: -.01em; line-height: 1.3; }
.sender { display: flex; gap: 14px; padding: 18px 32px 4px; align-items: flex-start; }
.sender .avatar { width: 44px; height: 44px; font-size: 16px; }
.sender .who { flex: 1; min-width: 0; }
.sender .who b { font-weight: 700; }
.sender .who .em { color: var(--muted); font-size: 13px; }
.sender .meta { color: var(--muted); font-size: 12.5px; margin-top: 3px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.auth-ok { color: var(--ok); display: inline-flex; gap: 4px; align-items: center; font-weight: 600; }
.otp-banner { margin: 18px 32px 0; padding: 18px 20px; border-radius: var(--radius); background: linear-gradient(135deg, #f1efff 0%, #faf5ff 100%); border: 1px solid #e1dcff; display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.otp-banner .ico { width: 44px; height: 44px; border-radius: 12px; background: var(--grad); color: #fff; display: grid; place-items: center; }
.otp-banner .code { font-size: 30px; font-weight: 800; letter-spacing: .16em; font-variant-numeric: tabular-nums; font-family: ui-monospace, "SF Mono", Menlo, monospace; color: #1f1d5c; }
.otp-banner .lbl { font-size: 11.5px; color: #6d5ce8; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.otp-banner .acts { margin-left: auto; display: flex; gap: 10px; }
.body-card { margin: 20px 32px 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.body-frame { display: block; width: 100%; border: 0; min-height: 260px; background: #fff; }
.body-text { margin: 0; padding: 20px; white-space: pre-wrap; font-family: inherit; line-height: 1.6; }
.atts { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 32px 0; }
.att { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; font-size: 13px; display: flex; gap: 10px; align-items: center; background: #fff; }
.att:hover { background: #f8f8fd; border-color: #d9dbe7; }
.att .ico { width: 32px; height: 32px; border-radius: 8px; background: var(--danger-bg); color: var(--danger); display: grid; place-items: center; }
.reply-bar { display: flex; gap: 10px; margin: 24px 32px 0; }

/* ------------------------------------------------------------------ compose */
.compose { position: fixed; right: 28px; bottom: 0; width: 580px; max-width: calc(100vw - 32px); background: #fff; border-radius: 16px 16px 0 0; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; z-index: 50; max-height: 86vh; border: 1px solid var(--line); animation: up .18s ease-out; }
@keyframes up { from { transform: translateY(20px); opacity: 0; } }
.compose-head { background: var(--side); color: #fff; padding: 12px 16px; border-radius: 16px 16px 0 0; display: flex; align-items: center; gap: 10px; font-weight: 600; }
.compose-head .x { margin-left: auto; color: #c7cbe3; width: 30px; height: 30px; }
.compose-head .x:hover { background: var(--side-2); }
.c-row { display: flex; align-items: center; border-bottom: 1px solid var(--line-soft); padding: 0 16px; }
.c-row label { color: var(--muted); width: 52px; font-size: 13px; font-weight: 600; }
.c-row input, .c-row select { flex: 1; border: 0; outline: none; padding: 12px 0; background: transparent; }
.compose textarea { border: 0; outline: none; resize: none; padding: 14px 16px; min-height: 280px; flex: 1; line-height: 1.55; }
.compose-foot { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--line-soft); }
.compose-foot .files { font-size: 12px; color: var(--muted); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ------------------------------------------------------------------ modal & tables */
.overlay { position: fixed; inset: 0; background: rgba(14, 17, 36, .5); backdrop-filter: blur(3px); display: grid; place-items: center; z-index: 60; padding: 20px; animation: fade .15s ease-out; }
@keyframes fade { from { opacity: 0; } }
.modal { background: #fff; border-radius: 18px; width: 100%; max-width: 460px; padding: 26px; box-shadow: var(--shadow-lg); animation: pop .18s ease-out; }
@keyframes pop { from { transform: scale(.97); opacity: 0; } }
.modal-ico { width: 46px; height: 46px; border-radius: 13px; background: var(--accent-weak); color: var(--accent); display: grid; place-items: center; margin-bottom: 14px; }
.modal h3 { margin: 0 0 6px; font-size: 19px; font-weight: 700; letter-spacing: -.01em; }
.modal .hint { color: var(--muted); margin: 0 0 20px; font-size: 13.5px; line-height: 1.55; }
.modal .actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.addr-input { display: flex; align-items: stretch; border: 1px solid #dcdfea; border-radius: 10px; overflow: hidden; transition: border-color .15s, box-shadow .15s; }
.addr-input:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-weak); }
.addr-input input { border: 0; outline: none; padding: 12px 14px; flex: 1; min-width: 0; }
.addr-input span { background: #f6f7fb; color: var(--muted); padding: 0 14px; display: grid; place-items: center; border-left: 1px solid #e6e8f0; font-size: 13.5px; }
.phone-row { display: flex; gap: 8px; }
.phone-row select { width: 120px; }
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.tbl th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; padding: 12px 14px; background: #fafbfe; border-bottom: 1px solid var(--line); }
.tbl td { padding: 13px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: #fafaff; }
.pill { padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 650; display: inline-flex; align-items: center; gap: 6px; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.on { background: var(--ok-bg); color: var(--ok); }
.pill.off { background: var(--danger-bg); color: var(--danger); }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12.5px; }
.muted { color: var(--muted); }
.cell-user { display: flex; gap: 12px; align-items: center; }
.cell-user .avatar { width: 32px; height: 32px; font-size: 13px; }
.cell-user b { font-weight: 650; }
.action-badge { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px; padding: 3px 8px; border-radius: 6px; background: var(--accent-weak); color: var(--accent); font-weight: 600; }

.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: #14172e; color: #fff; padding: 12px 18px; border-radius: 12px; z-index: 100; box-shadow: var(--shadow-lg); max-width: 460px; display: flex; gap: 10px; align-items: center; font-weight: 500; animation: up .18s ease-out; }
.toast .i { color: #86efac; }
.spinner { width: 20px; height: 20px; border: 2.5px solid #d9dcff; border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }
.btn-primary .spinner { border-color: rgba(255,255,255,.35); border-top-color: #fff; width: 18px; height: 18px; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1100px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } .row { grid-template-columns: 22px 36px 140px minmax(0, 1fr) auto; } }
@media (max-width: 900px) {
  .login { grid-template-columns: 1fr; } .login-hero { display: none; }
  .shell { grid-template-columns: 1fr; } .side { display: none; }
  .main { margin: 0 12px 12px; } .topbar { padding: 12px; }
  .row { grid-template-columns: 22px 36px minmax(0, 1fr) auto; } .row .from { display: none; }
}

[hidden] { display: none !important; }

/* credentials dialog */
.cred { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin-bottom: 12px; }
.cred-row { display: grid; grid-template-columns: 80px 1fr auto; gap: 10px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line-soft); }
.cred-row:last-child { border-bottom: 0; }
.cred-l { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.cred-v { font-weight: 600; overflow-wrap: anywhere; }
.cred-v.mono { font-size: 15px; letter-spacing: .03em; color: #1f1d5c; }
.cred-warn { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; color: var(--warn); background: var(--warn-bg); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; }

/* popover menu */
.menu { position: fixed; z-index: 70; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; min-width: 200px; animation: pop .12s ease-out; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border-radius: 8px; text-align: left; font-weight: 500; color: var(--text-2); }
.menu-item:hover { background: #f4f5fa; color: var(--text); }
.menu-item.danger { color: var(--danger); }
.menu-item.danger:hover { background: var(--danger-bg); }
.menu-sep { height: 1px; background: var(--line-soft); margin: 5px 4px; }
.btn-danger-solid { background: var(--danger); color: #fff; }
.btn-danger-solid:hover { background: #b42524; }
.btn-danger-solid:disabled { opacity: .45; cursor: default; }
.orig-note { display: flex; gap: 10px; align-items: flex-start; margin: 0 16px 8px; padding: 10px 12px; border-radius: 10px; background: #f6f7fb; border: 1px solid var(--line-soft); font-size: 12.5px; }
.orig-note .i { color: var(--accent); margin-top: 2px; }
.compose textarea { min-height: 200px; }
.pill.none { background: #f1f2f8; color: var(--muted); }
.check { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; margin: 4px 0 14px; cursor: pointer; font-size: 13px; line-height: 1.45; }
.check:hover { background: #fafaff; }
.check input { width: 18px; height: 18px; margin-top: 1px; accent-color: var(--accent); flex: none; }
/* recipient chips */
.rcpt { flex: 1; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 7px 0; min-height: 44px; cursor: text; }
.rcpt input { flex: 1; min-width: 140px; border: 0; outline: none; padding: 4px 0; background: transparent; }
.rchip { display: inline-flex; align-items: center; gap: 4px; background: var(--accent-weak); color: #3a37b8; border-radius: 20px; padding: 3px 4px 3px 10px; font-size: 13px; font-weight: 550; max-width: 100%; }
.rchip button { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; color: inherit; opacity: .7; }
.rchip button:hover { background: rgba(58, 55, 184, .15); opacity: 1; }
.rchip button .i { width: 12px; height: 12px; }
.rchip.bad { background: var(--danger-bg); color: var(--danger); }
.rchips { display: contents; }
.chip.fwd { background: #eef6ff; color: #1d5fbf; font-weight: 600; }
.rcpt-box { border: 1px solid #dcdfea; border-radius: 10px; padding: 0 12px; }
.rcpt-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-weak); }
/* labels */
.lbl-chip { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 650; white-space: nowrap; line-height: 1.5; }
button.lbl-chip:hover { filter: brightness(.96); }
.lbl-row { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.lbl-suggest { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.side-labels { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.side-lbl { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--side-text); background: #171b36; border: 1px solid #262b4d; padding: 3px 10px; border-radius: 20px; }
.side-lbl:hover { border-color: #3a4070; color: #fff; }
.side-lbl.on { border-color: transparent; background: #2a2f55; color: #fff; }
.side-lbl .dot { width: 7px; height: 7px; border-radius: 50%; }
.mb-lbl-dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.mb-count { margin-left: auto; font-size: 11.5px; color: var(--side-muted); }
/* assignees */
.assign-head { display: grid; grid-template-columns: 1fr 1.3fr 36px; gap: 8px; font-size: 12px; color: var(--muted); font-weight: 600; margin-bottom: 6px; }
.assign-rows { display: grid; gap: 8px; margin-bottom: 6px; max-height: 320px; overflow-y: auto; }
.assign-row { display: grid; grid-template-columns: 1fr 1.3fr 36px; gap: 8px; align-items: center; }
.assign-row .input { padding: 10px 12px; }
.assignees { display: flex; gap: 10px; align-items: center; }
.assignees .stack { display: flex; }
.assignees .stack .avatar { border: 2px solid #fff; margin-left: -8px; }
.assignees .stack .avatar:first-child { margin-left: 0; }
.pill { white-space: nowrap; }
.tbl td.muted { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lbl-chip.grp { background: #eef1f6; color: #334155; gap: 4px; }
.lbl-chip.grp .i { width: 11px; height: 11px; }
/* audit log */
.audit-list { max-width: 900px; }
.audit-day { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 18px 0 8px; }
.audit-day:first-child { margin-top: 0; }
.audit-row { display: flex; gap: 14px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line-soft); border-radius: 12px; margin-bottom: 8px; background: #fff; }
.audit-row:hover { border-color: var(--line); box-shadow: var(--shadow-sm); }
.audit-ico { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex: none; }
.audit-ico.indigo { background: #eef0ff; color: #4f46e5; } .audit-ico.green { background: var(--ok-bg); color: var(--ok); }
.audit-ico.red { background: var(--danger-bg); color: var(--danger); } .audit-ico.amber { background: var(--warn-bg); color: var(--warn); }
.audit-ico.violet { background: #f3edff; color: #7c3aed; } .audit-ico.gray { background: #f1f2f8; color: var(--text-2); }
.audit-main { min-width: 0; flex: 1; }
.audit-text { color: var(--text-2); line-height: 1.5; overflow-wrap: anywhere; }
.audit-text b { color: var(--text); font-weight: 650; }
.audit-meta { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.grp-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.grp-opt { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 10px; font-weight: 600; font-size: 13px; color: var(--text-2); background: #fff; }
.grp-opt:hover { border-color: #c9ccff; }
.grp-opt.on { border-color: var(--accent); background: var(--accent-weak); color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
.grp-opt .dot { width: 8px; height: 8px; border-radius: 50%; }
.grp-opt.add { border-style: dashed; color: var(--accent); }
.cat-filter { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 28px 0; }
.side-lbl.light { background: #fff; border: 1px solid var(--line); color: var(--text-2); padding: 5px 12px; font-size: 12.5px; }
.side-lbl.light:hover { border-color: #c9ccff; color: var(--text); }
.side-lbl.light.on { background: var(--accent-weak); color: var(--accent); border-color: var(--accent-weak); }
.side-lbl .n { font-weight: 700; opacity: .6; margin-left: 2px; }
button.assignees { text-align: left; padding: 4px 8px; margin: -4px -8px; border-radius: 10px; }
button.assignees:hover { background: #f4f5fa; }
.assign-pop { width: 320px; padding: 8px; }
.assign-pop-h { font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; padding: 6px 8px 8px; }
.assign-pop-list { max-height: 260px; overflow-y: auto; }
.assign-pop-row { display: flex; gap: 10px; align-items: center; padding: 7px 8px; border-radius: 8px; }
.assign-pop-row:hover { background: #f6f7fb; }
/* mailbox filter bar */
.fbar { display: flex; align-items: flex-end; gap: 16px; padding: 0 20px; border-bottom: 1px solid var(--line); background: #fcfcfe; }
.ftabs { display: flex; gap: 2px; overflow-x: auto; flex: 1; scrollbar-width: none; }
.ftab { --fc: var(--accent); display: inline-flex; align-items: center; gap: 8px; padding: 13px 14px 12px; font-weight: 600; font-size: 13.5px; color: var(--muted); border-bottom: 2.5px solid transparent; white-space: nowrap; transition: color .12s, border-color .12s; }
.ftab:hover { color: var(--text-2); }
.ftab.on { color: var(--text); border-bottom-color: var(--fc); }
.ftab .fdot { width: 9px; height: 9px; border-radius: 50%; }
.ftab .i { color: currentColor; opacity: .7; }
.fcount { font-size: 11.5px; font-weight: 700; padding: 1px 7px; border-radius: 10px; background: #eef0f5; color: var(--muted); min-width: 22px; text-align: center; }
.ftab.on .fcount { background: color-mix(in srgb, var(--fc) 14%, white); color: var(--fc); }
.fsearch { display: flex; align-items: center; gap: 8px; margin: 9px 0; padding: 0 12px; height: 36px; width: 280px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--muted); }
.fsearch:focus-within { border-color: #c9ccff; box-shadow: 0 0 0 3px var(--accent-weak); }
.fsearch input { flex: 1; border: 0; outline: none; background: transparent; font-size: 13.5px; color: var(--text); min-width: 0; }
.fsearch button { display: grid; place-items: center; color: var(--muted); }
@media (max-width: 1100px) { .fbar { flex-direction: column; align-items: stretch; gap: 0; } .fsearch { width: auto; } }
