:root {
    color-scheme: dark;
    --bg: #090b12;
    --panel: #11141e;
    --panel-2: #171b28;
    --panel-3: #1e2332;
    --line: rgba(255, 255, 255, .085);
    --text: #f4f6fb;
    --muted: #8f97aa;
    --accent: #9b8cff;
    --accent-2: #55d6be;
    --danger: #ff6e86;
    --warning: #ffbd66;
    --success: #55d6a7;
    --radius: 18px;
    --shadow: 0 20px 60px rgba(0, 0, 0, .32);
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 90% -20%, rgba(155, 140, 255, .16), transparent 30%), var(--bg); color: var(--text); }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
button { color: inherit; }
.icon { display: block; flex: 0 0 auto; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 250px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 24px 16px; border-right: 1px solid var(--line); background: rgba(9, 11, 18, .88); backdrop-filter: blur(24px); z-index: 30; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 10px 24px; font-size: 18px; font-weight: 750; letter-spacing: -.03em; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; color: #0d0e14; font-weight: 900; background: linear-gradient(135deg, #b5aaff, #62e4c9); box-shadow: 0 10px 30px rgba(155, 140, 255, .25); }
.nav-label { margin: 16px 11px 8px; color: #626a7e; font-size: 10px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.nav { display: grid; gap: 4px; }
.nav-link { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 12px; color: #aab1c1; font-size: 14px; font-weight: 620; transition: .18s ease; }
.nav-link:hover { color: var(--text); background: rgba(255,255,255,.045); }
.nav-link.active { color: #fff; background: linear-gradient(90deg, rgba(155,140,255,.22), rgba(155,140,255,.08)); box-shadow: inset 0 0 0 1px rgba(155,140,255,.18); }
.nav-icon { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 9px; background: rgba(255,255,255,.055); font-size: 11px; color: #c9c4ff; }
.sidebar-footer { position: absolute; bottom: 20px; left: 16px; right: 16px; }
.profile-mini { padding: 12px; display: flex; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.025); }
.avatar { width: 34px; height: 34px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 11px; background: linear-gradient(135deg, #4e456f, #272c3d); color: #dedaff; font-weight: 800; }
.profile-copy { min-width: 0; flex: 1; }
.profile-copy strong, .profile-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-copy strong { font-size: 12px; }
.profile-copy span { margin-top: 2px; color: var(--muted); font-size: 10px; }
.icon-button { border: 0; background: transparent; cursor: pointer; color: var(--muted); padding: 5px; border-radius: 8px; }
.icon-button:hover { color: var(--text); background: rgba(255,255,255,.06); }

.main { min-width: 0; }
.topbar { min-height: 78px; padding: 18px clamp(22px, 4vw, 52px); display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); background: rgba(9,11,18,.56); backdrop-filter: blur(18px); }
.eyebrow { margin-bottom: 4px; color: var(--muted); font-size: 11px; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; }
.topbar h1 { margin: 0; font-size: 23px; letter-spacing: -.035em; }
.top-actions { display: flex; gap: 10px; align-items: center; }
.content { width: min(1500px, 100%); margin: 0 auto; padding: 32px clamp(22px, 4vw, 52px) 60px; }
.btn.mobile-toggle { display: none; }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 24px; }
.page-head h2 { margin: 0 0 7px; font-size: 27px; letter-spacing: -.04em; }
.page-head p { margin: 0; color: var(--muted); line-height: 1.55; max-width: 700px; }
.actions { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; }

.btn { min-height: 40px; padding: 0 15px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel-2); color: #e5e7ee; font-weight: 700; font-size: 13px; cursor: pointer; transition: .18s ease; }
.btn:hover { transform: translateY(-1px); border-color: rgba(255,255,255,.18); background: var(--panel-3); }
.btn-primary { border-color: transparent; background: linear-gradient(135deg, #9b8cff, #7769e8); color: white; box-shadow: 0 10px 25px rgba(119,105,232,.24); }
.btn-primary:hover { background: linear-gradient(135deg, #aa9eff, #8375f1); }
.btn-success { border-color: rgba(85,214,167,.25); background: rgba(85,214,167,.12); color: #9bf0d0; }
.btn-danger { border-color: rgba(255,110,134,.28); background: rgba(255,110,134,.1); color: #ff9cad; }
.btn-ghost { background: transparent; }
.btn-sm { min-height: 32px; padding: 0 11px; font-size: 12px; border-radius: 9px; }

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stats-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); margin-bottom: 22px; }
.card { border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(145deg, rgba(23,27,40,.9), rgba(15,18,28,.92)); box-shadow: var(--shadow); }
.card-pad { padding: 22px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.card-head h3 { margin: 0; font-size: 15px; letter-spacing: -.015em; }
.card-body { padding: 20px; }
.stat-card { position: relative; overflow: hidden; min-height: 124px; padding: 18px; }
.stat-card::after { content: ""; position: absolute; width: 80px; height: 80px; right: -25px; bottom: -30px; border-radius: 50%; background: var(--glow, rgba(155,140,255,.15)); filter: blur(4px); }
.stats-grid .stat-card:nth-child(2)::after { --glow: rgba(91,151,255,.2); }
.stats-grid .stat-card:nth-child(3)::after { --glow: rgba(85,214,167,.2); }
.stats-grid .stat-card:nth-child(4)::after { --glow: rgba(85,214,190,.2); }
.stats-grid .stat-card:nth-child(5)::after { --glow: rgba(255,110,134,.2); }
.stats-grid .stat-card:nth-child(6)::after { --glow: rgba(255,189,102,.2); }
.stat-label { color: var(--muted); font-size: 11px; font-weight: 750; text-transform: uppercase; letter-spacing: .07em; }
.stat-value { margin: 19px 0 4px; font-size: 29px; line-height: 1; font-weight: 780; letter-spacing: -.04em; }
.stat-note { color: #727b8f; font-size: 11px; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { padding: 12px 16px; color: #70798c; font-size: 10px; text-align: left; text-transform: uppercase; letter-spacing: .1em; font-weight: 800; border-bottom: 1px solid var(--line); }
.table td { padding: 14px 16px; border-bottom: 1px solid rgba(255,255,255,.055); font-size: 13px; vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: .15s ease; }
.table tbody tr:hover { background: rgba(255,255,255,.022); }
.cell-main { font-weight: 700; color: #e9eaf0; }
.cell-sub { margin-top: 4px; color: var(--muted); font-size: 11px; }
.row-link { display: block; }

.status { display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border-radius: 999px; background: rgba(143,151,170,.1); color: #b0b6c4; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; }
.status-running, .status-active, .status-verified, .status-delivered, .status-open { color: var(--success); background: rgba(85,214,167,.09); }
.status-draft, .status-pending, .status-queued { color: #aab1c1; }
.status-scheduled, .status-processing, .status-accepted { color: #8db9ff; background: rgba(93,154,255,.1); }
.status-paused, .status-unsubscribed { color: var(--warning); background: rgba(255,189,102,.1); }
.status-failed, .status-stopped, .status-bounced, .status-complained { color: var(--danger); background: rgba(255,110,134,.09); }
.status-received, .status-sent { color: #a99bff; background: rgba(155,140,255,.1); }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.field { display: grid; gap: 8px; }
.field-span { grid-column: 1 / -1; }
.label { color: #c9cdd8; font-size: 12px; font-weight: 700; }
.hint { color: #71798c; font-size: 11px; line-height: 1.5; }
.input, .textarea, .select { width: 100%; min-height: 44px; border: 1px solid var(--line); border-radius: 11px; outline: none; background: #0d1018; color: var(--text); padding: 10px 12px; transition: .16s ease; }
.textarea { resize: vertical; min-height: 130px; line-height: 1.6; }
.textarea-lg { min-height: 240px; }
.input:focus, .textarea:focus, .select:focus { border-color: rgba(155,140,255,.65); box-shadow: 0 0 0 3px rgba(155,140,255,.11); }
.input::placeholder, .textarea::placeholder { color: #4f5667; }
.check-row { display: flex; gap: 10px; align-items: center; }
.checkbox { width: 17px; height: 17px; accent-color: var(--accent); }
.form-actions { display: flex; justify-content: flex-end; align-items: center; gap: 10px; margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); }
.form-divider { display: flex; align-items: center; gap: 12px; color: #626a7e; font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.form-divider::before, .form-divider::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.new-list-fields { display: grid; gap: 20px; padding: 20px; border: 1px solid rgba(155,140,255,.14); border-radius: 14px; background: rgba(155,140,255,.025); }
.color-picker { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 9px; }
.color-choice { position: relative; min-width: 0; min-height: 48px; display: flex; align-items: center; gap: 9px; padding: 10px 11px; border: 1px solid var(--line); border-radius: 11px; background: #0d1018; color: #aeb4c1; cursor: pointer; transition: border-color .16s ease, background .16s ease, box-shadow .16s ease, transform .16s ease; }
.color-choice:hover { border-color: rgba(255,255,255,.18); background: rgba(255,255,255,.025); transform: translateY(-1px); }
.color-choice:has(.color-choice-input:checked) { border-color: color-mix(in srgb, var(--list-color) 62%, transparent); background: color-mix(in srgb, var(--list-color) 10%, #0d1018); box-shadow: 0 0 0 2px color-mix(in srgb, var(--list-color) 10%, transparent), inset 0 0 20px color-mix(in srgb, var(--list-color) 4%, transparent); color: #f2f3f8; }
.color-choice:has(.color-choice-input:focus-visible) { outline: 2px solid var(--list-color); outline-offset: 2px; }
.color-choice-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.color-swatch { width: 17px; height: 17px; flex: 0 0 17px; border: 2px solid rgba(255,255,255,.28); border-radius: 50%; background: var(--list-color); box-shadow: 0 0 13px color-mix(in srgb, var(--list-color) 58%, transparent); }
.color-choice-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: 11px; font-weight: 700; white-space: nowrap; }
.color-choice-check { margin-left: auto; color: var(--list-color); font-size: 13px; font-weight: 900; opacity: 0; transform: scale(.7); transition: opacity .16s ease, transform .16s ease; }
.color-choice-input:checked ~ .color-choice-check { opacity: 1; transform: scale(1); }
.custom-fields { display: grid; gap: 9px; }
.custom-field-row { display: grid; grid-template-columns: .7fr 1fr auto; gap: 9px; align-items: center; }
.search { position: relative; width: min(340px, 100%); }
.search .input { padding-left: 38px; }
.search::before { content: "⌕"; position: absolute; left: 14px; top: 9px; color: var(--muted); font-size: 20px; z-index: 2; }

.alert { margin-bottom: 18px; padding: 13px 16px; border: 1px solid; border-radius: 12px; font-size: 13px; line-height: 1.5; }
.alert-success { color: #a4efd5; border-color: rgba(85,214,167,.24); background: rgba(85,214,167,.09); }
.alert-error { color: #ffabb9; border-color: rgba(255,110,134,.28); background: rgba(255,110,134,.09); }
.error-list { margin: 7px 0 0; padding-left: 18px; }
.empty { padding: 50px 24px; text-align: center; color: var(--muted); }
.empty-mark { width: 54px; height: 54px; margin: 0 auto 14px; display: grid; place-items: center; border-radius: 17px; background: rgba(155,140,255,.1); color: #b9b0ff; font-size: 22px; }
.empty h3 { margin: 0 0 7px; color: var(--text); font-size: 16px; }
.empty p { margin: 0 auto 18px; max-width: 430px; line-height: 1.6; }

.list-card { padding: 18px; display: flex; flex-direction: column; min-height: 170px; }
.list-card-top { display: flex; justify-content: space-between; align-items: flex-start; }
.list-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--list-color, var(--accent)); box-shadow: 0 0 16px var(--list-color, var(--accent)); }
.color-violet, .dot-violet { --list-color: #9b8cff; }
.color-indigo, .dot-indigo { --list-color: #7c8cff; }
.color-blue, .dot-blue { --list-color: #5b9cff; }
.color-cyan, .dot-cyan { --list-color: #55cfe1; }
.color-emerald, .dot-emerald { --list-color: #55d6a7; }
.color-lime, .dot-lime { --list-color: #9ed85d; }
.color-amber, .dot-amber { --list-color: #ffbd66; }
.color-orange, .dot-orange { --list-color: #ff9364; }
.color-rose, .dot-rose { --list-color: #ff6e86; }
.color-pink, .dot-pink { --list-color: #e879c6; }
.list-card h3 { margin: 18px 0 8px; font-size: 16px; }
.list-card p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.list-card-footer { margin-top: auto; padding-top: 18px; display: flex; justify-content: space-between; color: #787f90; font-size: 11px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 5px 8px; border-radius: 8px; background: rgba(255,255,255,.055); color: #aeb4c1; font-size: 10px; }
.progress { height: 7px; overflow: hidden; border-radius: 999px; background: rgba(255,255,255,.055); }
.progress-bar { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.progress-native { width: 100%; height: 7px; overflow: hidden; border: 0; border-radius: 999px; background: rgba(255,255,255,.055); }
.progress-native::-webkit-progress-bar { background: rgba(255,255,255,.055); border-radius: 999px; }
.progress-native::-webkit-progress-value { background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 999px; }
.progress-native::-moz-progress-bar { background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 999px; }
.spaced { margin-top: 20px; }

.detail-grid { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(280px, .8fr); gap: 20px; }
.meta-list { display: grid; gap: 14px; }
.meta-row { display: flex; justify-content: space-between; gap: 20px; align-items: baseline; }
.meta-row span:first-child { color: var(--muted); font-size: 12px; }
.meta-row span:last-child { text-align: right; font-size: 12px; font-weight: 650; }
.email-preview { padding: 22px; border-radius: 14px; background: #f5f3ed; color: #292c32; }
.email-preview-subject { padding-bottom: 14px; margin-bottom: 16px; border-bottom: 1px solid #dad7cf; font-weight: 760; }
.email-preview-body { white-space: pre-wrap; font: 14px/1.65 ui-monospace, SFMono-Regular, Menlo, monospace; }

.conversation-layout { display: grid; grid-template-columns: 340px minmax(0, 1fr); min-height: calc(100vh - 150px); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--panel); }
.conversation-list { border-right: 1px solid var(--line); }
.conversation-item { display: block; padding: 16px; border-bottom: 1px solid var(--line); transition: .15s; }
.conversation-item:hover, .conversation-item.active { background: rgba(155,140,255,.07); }
.conversation-item-head { display: flex; justify-content: space-between; gap: 10px; }
.conversation-item strong { font-size: 13px; }
.conversation-item time { color: #666e80; font-size: 9px; }
.conversation-item p { margin: 7px 0 0; color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread { display: flex; flex-direction: column; min-height: 600px; }
.thread-head { padding: 17px 20px; display: flex; justify-content: space-between; border-bottom: 1px solid var(--line); }
.messages { flex: 1; padding: 24px; display: flex; flex-direction: column; gap: 16px; overflow-y: auto; max-height: 60vh; }
.message { width: min(76%, 720px); padding: 14px 16px; border-radius: 15px 15px 15px 4px; background: var(--panel-3); }
.message-out { margin-left: auto; border-radius: 15px 15px 4px 15px; background: linear-gradient(145deg, rgba(119,105,232,.34), rgba(80,73,148,.35)); }
.message-body { white-space: pre-wrap; color: #e0e3ea; font-size: 13px; line-height: 1.65; }
.message-meta { margin-top: 8px; color: #858c9d; font-size: 9px; }
.reply-box { padding: 16px 20px 20px; border-top: 1px solid var(--line); background: rgba(0,0,0,.12); }
.reply-box .textarea { min-height: 90px; }

.pagination { margin-top: 20px; display: flex; align-items: center; justify-content: space-between; gap: 14px; color: var(--muted); font-size: 12px; }
.pagination-links { display: flex; gap: 5px; }
.page-link { min-width: 34px; height: 34px; padding: 0 9px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); }
.page-link.active { border-color: rgba(155,140,255,.45); background: rgba(155,140,255,.16); color: white; }
.page-link.disabled { opacity: .35; pointer-events: none; }

.guest-shell { min-height: 100vh; display: grid; grid-template-columns: 1.1fr .9fr; }
.guest-art { position: relative; overflow: hidden; padding: 58px; display: flex; flex-direction: column; justify-content: space-between; border-right: 1px solid var(--line); background: radial-gradient(circle at 30% 30%, rgba(155,140,255,.22), transparent 38%), radial-gradient(circle at 75% 75%, rgba(85,214,190,.12), transparent 30%), #0d1018; }
.guest-art::after { content: ""; position: absolute; width: 520px; height: 520px; right: -120px; top: 18%; border: 1px solid rgba(255,255,255,.08); border-radius: 50%; box-shadow: 0 0 0 70px rgba(255,255,255,.015), 0 0 0 140px rgba(255,255,255,.012); }
.guest-copy { position: relative; z-index: 2; max-width: 620px; }
.guest-copy h1 { margin: 0 0 18px; font-size: clamp(42px, 6vw, 78px); line-height: .98; letter-spacing: -.065em; }
.guest-copy h1 span { color: #a99dff; }
.guest-copy p { max-width: 490px; color: #a2a9b9; font-size: 16px; line-height: 1.65; }
.guest-form-wrap { padding: 30px; display: grid; place-items: center; }
.login-card { width: min(410px, 100%); }
.login-card h2 { margin: 0 0 7px; font-size: 28px; letter-spacing: -.04em; }
.login-card > p { margin: 0 0 28px; color: var(--muted); line-height: 1.55; }
.login-card .field { margin-bottom: 16px; }
.login-card .btn { width: 100%; margin-top: 8px; }

@media (max-width: 1200px) {
    .stats-grid { grid-template-columns: repeat(3, 1fr); }
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
    .app-shell { display: block; }
    .sidebar { position: fixed; transform: translateX(-102%); width: 250px; transition: .22s ease; box-shadow: 30px 0 80px rgba(0,0,0,.55); }
    body.nav-open .sidebar { transform: translateX(0); }
    .btn.mobile-toggle { display: inline-flex; }
    .topbar { padding: 15px 20px; }
    .content { padding: 24px 20px 50px; }
    .detail-grid, .conversation-layout { grid-template-columns: 1fr; }
    .conversation-list { display: none; }
    .guest-shell { grid-template-columns: 1fr; }
    .guest-art { display: none; }
    .color-picker { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
    .stats-grid, .grid-2, .grid-3, .grid-4, .form-grid { grid-template-columns: 1fr; }
    .custom-field-row { grid-template-columns: 1fr; }
    .field-span { grid-column: auto; }
    .page-head { align-items: stretch; flex-direction: column; }
    .page-head .actions .btn { flex: 1; }
    .stat-card { min-height: 108px; }
    .topbar h1 { font-size: 19px; }
    .message { width: 92%; }
    .new-list-fields { padding: 16px; }
    .color-picker { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
