:root {
  --bg1: #5ee7df;
  --bg2: #b490ca;
  --bg3: #ffafbd;
  --bg4: #ffc3a0;
  --glass-bg: rgba(255, 255, 255, 0.12);
  --glass-border: rgba(255, 255, 255, 0.35);
  --text: #f7f8fa;
  --muted: #d6dae0;
  --accent: #7cf5ff;
  --success: #5df2a5;
  --warning: #ffe380;
  --danger: #ff97a0;
}

body.light {
  --glass-bg: rgba(255,255,255,0.5); /* clearer glass */
  --glass-border: rgba(0,0,0,0.06);
  --text: #0b1322;
  --muted: #334155;
  --accent: #0ea5e9;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  position: relative; /* for extended background overlay */
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: var(--text);
  /* Deep black with very subtle colorful glows */
  background: radial-gradient(1000px 700px at 10% 15%, rgba(94,231,223,0.08) 0%, transparent 50%),
              radial-gradient(1000px 700px at 85% 20%, rgba(180,144,202,0.08) 0%, transparent 50%),
              radial-gradient(1000px 700px at 15% 85%, rgba(255,175,189,0.08) 0%, transparent 50%),
              radial-gradient(1000px 700px at 80% 85%, rgba(255,195,160,0.08) 0%, transparent 50%),
              linear-gradient(120deg, #000000, #0a0a0a);
  overflow-x: hidden;
}
body.light {
  /* very light, diffused pastel background */
  background: radial-gradient(1200px 800px at 10% 10%, #fdf2f8 0%, transparent 50%),
              radial-gradient(1200px 800px at 90% 20%, #e0f2fe 0%, transparent 50%),
              radial-gradient(1200px 800px at 20% 90%, #ecfccb 0%, transparent 50%),
              radial-gradient(1200px 800px at 80% 85%, #ffedd5 0%, transparent 50%),
              linear-gradient(120deg, #fafafa, #f4f6fb);
}

/* Extended background overlay to avoid cut-off on long pages */
.bg { 
  position: absolute; 
  top: 0; 
  left: 0; 
  width: 100%; 
  height: 300%; /* cover long scroll */
  pointer-events: none; 
  filter: blur(40px) saturate(120%); 
  opacity: 0.5; 
  z-index: 0; 
}

.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.12), inset 0 0 0 1px rgba(255,255,255,0.08);
}
/* clearer glass + softer shadow on light theme */
body.light .glass { backdrop-filter: blur(18px) saturate(150%); box-shadow: 0 12px 24px rgba(0,0,0,0.08), inset 0 0 0 1px rgba(255,255,255,0.6); }

.header { position: static; margin: 16px auto; width: 100%; max-width: 1400px; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo { width: 24px; height: 24px; border-radius: 6px; }
.logo { font-size: 20px; }
.header h1 { margin: 0; font-size: 20px; font-weight: 800; letter-spacing: 0.3px; }

.actions { display: flex; gap: 10px; align-items: stretch; }
.actions .input, .actions .btn { height: 38px; display: inline-flex; align-items: center; }
body.light .btn, body.light .input { color: #0f172a; }
body.light .btn.btn-close { color: #0f172a; }

/* Remove underlines on brand/login links/buttons */
.brand a { text-decoration: none; color: inherit; }
.btn, .btn:focus, .btn:hover { text-decoration: none; outline: none; }
a, a:hover, a:focus { text-decoration: none; }

.date-range { display: inline-flex; gap: 8px; align-items: center; }
.date-range .input { padding: 6px 10px; }

.input {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.25);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 12px;
  outline: none;
  min-width: 260px;
}
body.light .input { background: rgba(255,255,255,0.9); border: 1px solid rgba(0,0,0,0.1); }
.input::placeholder { color: #cbd5e1; }

.btn {
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.25);
  background: linear-gradient(135deg, rgba(124,245,255,0.15), rgba(255,255,255,0.05));
  color: var(--text);
  cursor: pointer;
}
body.light .btn { border-color: rgba(0,0,0,0.1); background: rgba(255,255,255,0.8); }
.btn:hover { transform: translateY(-1px); box-shadow: 0 8px 18px rgba(0,0,0,0.25); }

.btn-primary {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: white;
  border-color: #3b82f6;
}
.btn-primary:hover {
  background: linear-gradient(135deg, #2563eb, #1e40af);
  border-color: #2563eb;
}

.container { max-width: 1400px; margin: 0 auto 100px; padding: 0 16px; }
.panel { padding: 18px; margin-top: 8px; }
.panel-header { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.section-logo { margin-right: 8px; border-radius: 6px; }
.summary { color: var(--muted); font-size: 13px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.card { padding: 16px; transition: transform 0.2s ease, box-shadow 0.2s ease; }
.card:hover { transform: translateY(-3px); box-shadow: 0 16px 34px rgba(0,0,0,0.35); }

.card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.badge { font-size: 11px; padding: 4px 8px; border-radius: 999px; border: 1px solid rgba(255,255,255,0.3); background: rgba(255,255,255,0.08); }
body.light .badge { border-color: rgba(0,0,0,0.1); background: rgba(0,0,0,0.05); }
.id { font-size: 12px; color: var(--muted); }
.name { margin: 8px 0 2px; font-size: 16px; letter-spacing: 0.2px; }
.meta { font-size: 12px; color: var(--muted); }

.metrics { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.metric { display: inline-flex; gap: 6px; align-items: center; font-size: 12px; padding: 6px 10px; border-radius: 999px; border: 1px solid rgba(255,255,255,0.18); background: rgba(255,255,255,0.06); }
body.light .metric { border-color: rgba(0,0,0,0.08); background: rgba(0,0,0,0.04); }
.metric .dot { width: 7px; height: 7px; border-radius: 50%; background: #94a3b8; box-shadow: 0 0 12px currentColor; }
.metric.sent { color: #a3e635; border-color: #a3e63555; }
.metric.sent .dot { background: #a3e635; }
.metric.open { color: #60a5fa; border-color: #60a5fa55; }
.metric.open .dot { background: #60a5fa; }
.metric.reply { color: #f472b6; border-color: #f472b655; }
.metric.reply .dot { background: #f472b6; }

.badge.ACTIVE { border-color: rgba(93,242,165,0.6); background: rgba(93,242,165,0.12); color: var(--success); }
.badge.DRAFTED { color: #a0c4ff; border-color: #a0c4ff44; background: #a0c4ff20; }
.badge.PAUSED { color: #ffd6a5; border-color: #ffd6a544; background: #ffd6a520; }
.badge.STOPPED { color: var(--danger); border-color: #ff97a044; background: #ff97a020; }
.badge.COMPLETED { color: #bdb2ff; border-color: #bdb2ff44; background: #bdb2ff20; }

.empty { text-align: center; color: var(--muted); padding: 24px; }
.hidden { display: none; }

/* bottom chart embedded style */
.bottom-chart { margin-top: 24px; }

/* Date range controls */
.date-range { display: flex; align-items: center; gap: 8px; }
/* Ensure Litepicker popup appears above everything */
.litepicker { z-index: 9999 !important; }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.45); backdrop-filter: blur(2px); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 50; }
.modal.hidden { display: none; }
.modal-dialog { width: min(900px, 96vw); padding: 14px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 8px 10px; }
.modal-header h3 { margin: 0; font-size: 16px; }
.modal-body { padding: 8px; height: 260px; }
.btn-close { line-height: 1; padding: 6px 10px; }

.openers { margin-top: 12px; }
.openers-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 4px 10px; }
.openers-header h4 { margin: 0; font-weight: 700; letter-spacing: .2px; }
.openers-actions { display: flex; gap: 10px; align-items: center; }
.table-wrap { overflow: auto; border-radius: 10px; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table thead th { position: sticky; top: 0; background: rgba(255,255,255,0.06); color: var(--muted); text-align: left; padding: 10px; border-bottom: 1px solid rgba(255,255,255,0.12); }
body.light .table thead th { background: rgba(0,0,0,0.04); border-bottom: 1px solid rgba(0,0,0,0.08); }
.table tbody td { padding: 10px; border-bottom: 1px solid rgba(255,255,255,0.07); }
body.light .table tbody td { border-bottom: 1px solid rgba(0,0,0,0.06); }
.table tr:hover td { background: rgba(255,255,255,0.04); }
body.light .table tr:hover td { background: rgba(0,0,0,0.03); }
.table a { color: #93c5fd; text-decoration: none; }
.mail-link { white-space: nowrap; }
.subject { color: #e2e8f0; }
body.light .subject { color: #111827; }
.time { color: var(--muted); white-space: nowrap; }
.seq { color: #cbd5e1; }
.opens { font-weight: 700; }

.thread { margin-top: 14px; padding: 12px; border-radius: 12px; border: 1px solid rgba(255,255,255,0.15); background: rgba(255,255,255,0.05); }
body.light .thread { border-color: rgba(0,0,0,0.08); background: rgba(0,0,0,0.03); }
.thread.hidden { display: none; }
.thread-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.thread-header h4 { margin: 0; }
.thread-body { display: grid; gap: 10px; max-height: 280px; overflow: auto; padding-right: 6px; }
.msg { padding: 10px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.12); background: rgba(255,255,255,0.06); }
body.light .msg { border-color: rgba(0,0,0,0.08); background: rgba(0,0,0,0.03); }
.msg .meta { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.msg .type-SENT { color: #a3e635; }
.msg .type-REPLY { color: #f472b6; }
.msg .subject { font-weight: 600; margin-bottom: 4px; }
.msg .body { color: #e5e7eb; }
body.light .msg .body { color: #0f172a; } 