* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0d1117; --surface: #161b22; --surface2: #21262d; --border: #30363d;
  --text: #e6edf3; --text2: #8b949e; --primary: #238636; --primary-hover: #2ea043;
  --blue: #1f6feb; --red: #f85149; --yellow: #d29922; --green: #3fb950; --sidebar-w: 220px;
}

body { background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 14px; display: flex; min-height: 100vh; }

#sidebar { width: var(--sidebar-w); background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; position: fixed; top: 0; left: 0; height: 100vh; z-index: 100; }
#sidebar .logo { padding: 20px 16px 12px; font-size: 16px; font-weight: 700; color: var(--green); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 8px; }
#sidebar nav { flex: 1; padding: 8px 0; overflow-y: auto; }
#sidebar nav a { display: flex; align-items: center; gap: 10px; padding: 9px 16px; color: var(--text2); text-decoration: none; font-size: 13px; border-left: 3px solid transparent; transition: all .15s; }
#sidebar nav a:hover { background: var(--surface2); color: var(--text); }
#sidebar nav a.active { color: var(--text); background: var(--surface2); border-left-color: var(--green); }
#sidebar nav a .icon { width: 18px; text-align: center; }
#sidebar .status-bar { padding: 12px 16px; border-top: 1px solid var(--border); font-size: 12px; }
#sidebar .status-bar .account-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--text2); }
#sidebar .status-bar .account-dot.green { background: var(--green); }
#sidebar .status-bar .account-dot.yellow { background: var(--yellow); }
#sidebar .status-bar .account-dot.red { background: var(--red); }

#main { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }
#topbar { background: var(--surface); border-bottom: 1px solid var(--border); padding: 12px 24px; display: flex; align-items: center; justify-content: space-between; }
#topbar h1 { font-size: 16px; font-weight: 600; }
#content { padding: 24px; flex: 1; }

.cards-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 24px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 16px; }
.card .label { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--text2); margin-bottom: 8px; }
.card .value { font-size: 28px; font-weight: 700; }
.card.blue { border-color: var(--blue); } .card.green { border-color: var(--green); }
.card.red { border-color: var(--red); } .card.yellow { border-color: var(--yellow); }

.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
th { background: var(--surface2); padding: 10px 14px; text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--text2); }
td { padding: 10px 14px; border-top: 1px solid var(--border); vertical-align: middle; }
tr:hover td { background: var(--surface2); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.badge.sent, .badge.done { background: #1a3a24; color: var(--green); }
.badge.pending { background: #1a2a3a; color: var(--blue); }
.badge.failed { background: #3a1a1a; color: var(--red); }
.badge.running { background: #2a2a1a; color: var(--yellow); }
.badge.draft, .badge.cancelled, .badge.skipped { background: var(--surface2); color: var(--text2); }
.badge.optout { background: #3a1a1a; color: var(--red); }
.badge.green { background: #1a3a24; color: var(--green); }
.badge.yellow { background: #3a2a00; color: var(--yellow); }
.badge.red { background: #3a1a1a; color: var(--red); }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface2); color: var(--text); cursor: pointer; font-size: 13px; text-decoration: none; transition: all .15s; }
.btn:hover { background: var(--border); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-hover); }
.btn.danger { background: #3a1a1a; border-color: var(--red); color: var(--red); }
.btn.danger:hover { background: var(--red); color: #fff; }
.btn.small { padding: 4px 10px; font-size: 12px; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

.form-group { margin-bottom: 16px; }
label { display: block; margin-bottom: 6px; font-size: 13px; color: var(--text2); }
input, select, textarea { width: 100%; padding: 8px 12px; background: var(--surface2); border: 1px solid var(--border); border-radius: 6px; color: var(--text); font-size: 13px; outline: none; transition: border .15s; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); }
textarea { resize: vertical; min-height: 100px; font-family: inherit; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; margin-bottom: 20px; }
.panel-header { padding: 12px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; font-weight: 600; }
.panel-body { padding: 16px; }

.alert { padding: 12px 16px; border-radius: 6px; margin-bottom: 14px; font-size: 13px; }
.alert.success { background: #1a3a24; border: 1px solid var(--green); color: var(--green); }
.alert.error { background: #3a1a1a; border: 1px solid var(--red); color: var(--red); }
.alert.warning { background: #3a2a00; border: 1px solid var(--yellow); color: var(--yellow); }
.alert.info { background: #1a2a3a; border: 1px solid var(--blue); color: var(--blue); }

.progress { background: var(--surface2); border-radius: 4px; height: 6px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--green); border-radius: 4px; transition: width .5s; }

.toggle { position: relative; display: inline-block; width: 40px; height: 20px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; inset: 0; background: var(--border); border-radius: 20px; cursor: pointer; transition: .2s; }
.toggle input:checked + .toggle-slider { background: var(--green); }
.toggle-slider:before { content: ''; position: absolute; width: 16px; height: 16px; left: 2px; bottom: 2px; background: white; border-radius: 50%; transition: .2s; }
.toggle input:checked + .toggle-slider:before { transform: translateX(20px); }

.section-title { font-size: 15px; font-weight: 600; margin-bottom: 14px; }
.text-muted { color: var(--text2); }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; }
.flex { display: flex; } .items-center { align-items: center; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; }
.justify-between { justify-content: space-between; } .w-100 { width: 100%; }

#toast { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast-item { padding: 12px 20px; border-radius: 8px; font-size: 13px; background: var(--surface); border: 1px solid var(--border); animation: fadeIn .2s; }
.toast-item.success { border-color: var(--green); color: var(--green); }
.toast-item.error { border-color: var(--red); color: var(--red); }
.toast-item.warning { border-color: var(--yellow); color: var(--yellow); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; } }

.queue-list { list-style: none; }
.queue-list li { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.queue-list li:last-child { border-bottom: none; }

#global-alert { position: fixed; top: 0; left: var(--sidebar-w); right: 0; z-index: 200; padding: 10px 24px; font-size: 13px; font-weight: 600; display: none; }
#global-alert.show { display: block; }
#global-alert.yellow { background: #3a2a00; color: var(--yellow); border-bottom: 2px solid var(--yellow); }
#global-alert.red { background: #3a1a1a; color: var(--red); border-bottom: 2px solid var(--red); }
#global-alert.green { background: #1a3a24; color: var(--green); border-bottom: 2px solid var(--green); }

.preview-box { background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 14px; font-size: 13px; line-height: 1.6; white-space: pre-wrap; min-height: 60px; }
