/* ================= MASS Mailer - design system ================= */
:root {
  --bg: #0e1014; --bg2: #12151b;
  --panel: #171b23; --panel2: #1f242f; --panel3: #262c39;
  --border: #262c38; --border-light: #323a49;
  --fg: #e9ecf2; --muted: #8b93a5;
  --accent: #4f7cff; --accent-h: #6b90ff; --accent-soft: rgba(79, 124, 255, .13);
  --green: #22c55e; --green-soft: rgba(34, 197, 94, .12);
  --red: #ef4444; --red-soft: rgba(239, 68, 68, .12);
  --amber: #f59e0b; --amber-soft: rgba(245, 158, 11, .12);
  --radius: 12px; --radius-s: 8px;
  --shadow: 0 4px 16px rgba(0, 0, 0, .35);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; color: var(--fg); font-size: 14px;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  display: flex;
}
::selection { background: var(--accent-soft); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--panel3); border-radius: 6px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------------- sidebar ---------------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: 232px; z-index: 20;
  background: var(--bg2); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 18px 12px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-size: 18px; font-weight: 800; letter-spacing: .02em;
  padding: 4px 10px 18px;
}
.brand .logo {
  width: 32px; height: 32px; border-radius: 9px; flex: none;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 10px rgba(79, 124, 255, .4);
}
.brand .logo svg { width: 17px; height: 17px; stroke: #fff; }
nav { display: flex; flex-direction: column; gap: 3px; }
nav a {
  display: flex; align-items: center; gap: 11px;
  color: var(--muted); text-decoration: none;
  padding: 9px 12px; border-radius: var(--radius-s); font-weight: 500;
  transition: background .15s, color .15s;
}
nav a svg { width: 17px; height: 17px; flex: none; }
nav a:hover { background: var(--panel2); color: var(--fg); }
nav a.active { background: var(--accent-soft); color: var(--accent-h); font-weight: 600; }
.sidebar .bottom { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); }
.user-card {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
}
.user-card .avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  background: var(--panel3); color: var(--fg);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; text-transform: uppercase; font-size: 13px;
}
.user-card .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.user-card .role { color: var(--muted); font-size: 11px; }
.user-card a { margin-left: auto; color: var(--muted); display: flex; padding: 6px; border-radius: 6px; }
.user-card a:hover { background: var(--panel2); color: var(--red); }
.user-card a svg { width: 16px; height: 16px; }

/* ---------------- topbar + main ---------------- */
.main-wrap { margin-left: 232px; flex: 1; min-height: 100vh; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 14px;
  padding: 12px 26px; background: rgba(14, 16, 20, .85);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--border);
}
.profile-form { display: flex; align-items: center; gap: 8px; }
.profile-form label { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.sender {
  color: var(--muted); font-size: 12.5px;
  background: var(--panel); border: 1px solid var(--border);
  padding: 5px 11px; border-radius: 20px;
}
main { padding: 24px 26px 40px; max-width: 1200px; }

.page-head { margin-bottom: 18px; }
.page-head h1 { font-size: 21px; font-weight: 700; margin: 0 0 3px; }
.page-head p { margin: 0; }

/* ---------------- cards / layout helpers ---------------- */
.card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px; margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.card h2 { font-size: 14px; font-weight: 700; margin: 0 0 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.inline { display: inline-flex; margin: 0; padding: 0; background: none; border: none; box-shadow: none; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.lbl { color: var(--muted); font-size: 12px; margin-bottom: 6px; font-weight: 600; }
.ok-text { color: var(--green); }
.err-text { color: var(--red); }
.small-text { font-size: 12px; }

/* ---------------- stats ---------------- */
.stats { display: flex; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.stat {
  flex: 1; min-width: 120px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
  box-shadow: var(--shadow);
}
.stat .num { font-size: 26px; font-weight: 800; letter-spacing: -.01em; }
.stat .num.ok { color: var(--green); }
.stat .num.err { color: var(--red); }
.stat .num.acc { color: var(--accent-h); }
.stat .lbl { color: var(--muted); font-size: 11.5px; margin-top: 2px; text-transform: uppercase; letter-spacing: .05em; }

/* ---------------- forms ---------------- */
input, select, textarea {
  background: var(--bg2); color: var(--fg); border: 1px solid var(--border-light);
  border-radius: var(--radius-s); padding: 8px 11px; font: inherit;
  transition: border-color .15s, box-shadow .15s;
}
input:disabled { opacity: .55; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.check { display: flex; align-items: center; gap: 7px; cursor: pointer; }
.check input { accent-color: var(--accent); width: 15px; height: 15px; }
input[type="file"] { padding: 6px; }
input[type="file"]::file-selector-button {
  background: var(--panel3); color: var(--fg); border: none;
  border-radius: 6px; padding: 6px 12px; font: inherit; cursor: pointer; margin-right: 8px;
}
.search { min-width: 240px; padding-left: 32px; background-image: none; }
.table-tools { margin-bottom: 12px; }
.search-wrap { position: relative; display: inline-flex; align-items: center; }
.search-wrap svg { position: absolute; left: 10px; width: 15px; height: 15px; color: var(--muted); pointer-events: none; }

/* ---------------- buttons ---------------- */
.btn {
  background: var(--panel3); color: var(--fg); border: 1px solid transparent;
  border-radius: var(--radius-s); padding: 8px 16px; font: inherit; font-weight: 600;
  cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 7px;
  transition: background .15s, transform .05s, box-shadow .15s;
}
.btn:hover { background: var(--border-light); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.accent { background: var(--accent); color: #fff; box-shadow: 0 2px 8px rgba(79, 124, 255, .35); }
.btn.accent:hover { background: var(--accent-h); }
.btn.success { background: var(--green); color: #fff; box-shadow: 0 2px 8px rgba(34, 197, 94, .3); }
.btn.success:hover { background: #16a34a; }
.btn.danger { background: var(--red); color: #fff; }
.btn.danger:hover { background: #dc2626; }
.btn.ghost { background: transparent; border-color: var(--border-light); color: var(--muted); }
.btn.ghost:hover { color: var(--fg); background: var(--panel2); }
.btn.small { padding: 4px 11px; font-size: 12px; font-weight: 500; }

/* ---------------- banners / chips ---------------- */
.banner {
  border-radius: var(--radius-s); padding: 11px 15px; margin-bottom: 14px;
  border: 1px solid transparent; font-size: 13.5px;
}
.banner.warn { background: var(--amber-soft); color: var(--amber); border-color: rgba(245, 158, 11, .25); }
.banner.ok { background: var(--green-soft); color: var(--green); border-color: rgba(34, 197, 94, .25); }
.banner.err { background: var(--red-soft); color: var(--red); border-color: rgba(239, 68, 68, .25); }
.banner a { color: inherit; font-weight: 700; }
.chip {
  display: inline-block; padding: 3px 10px; border-radius: 20px;
  font-size: 11.5px; font-weight: 700;
}
.chip.green { background: var(--green-soft); color: var(--green); }
.chip.red { background: var(--red-soft); color: var(--red); }
.chip.acc { background: var(--accent-soft); color: var(--accent-h); }

/* ---------------- progress / warmup ---------------- */
.progress {
  height: 10px; background: var(--panel2); border-radius: 6px;
  overflow: hidden; margin-bottom: 6px;
}
.progress .bar {
  height: 100%; width: 0; border-radius: 6px;
  background: linear-gradient(90deg, var(--accent), #8b5cf6);
  transition: width .4s;
}
.wu-progress { height: 7px; background: var(--panel2); border-radius: 4px; overflow: hidden; margin: 12px 0 6px; }
.wu-progress .bar { height: 100%; background: linear-gradient(90deg, var(--green), #4ade80); border-radius: 4px; }

/* ---------------- log ---------------- */
.log {
  background: #0a0c10; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 13px 15px; margin-top: 12px;
  height: 330px; overflow-y: auto;
  font-family: Consolas, "Cascadia Mono", monospace; font-size: 13px;
}
.log .line { white-space: pre-wrap; word-break: break-all; padding: 1px 0; color: var(--muted); }
.log .ok { color: #4ade80; }
.log .err { color: #f87171; }
.log .warn { color: #fbbf24; }
.log .info { color: #9aa7ff; }

/* ---------------- tables ---------------- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 11px; border-bottom: 1px solid var(--border); }
th {
  color: var(--muted); font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
  position: sticky; top: 0; background: var(--panel); z-index: 1;
}
tbody tr { transition: background .12s; }
tbody tr:hover td { background: var(--panel2); }
td { font-size: 13.5px; }

/* ---------------- editors / settings ---------------- */
.editors { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.editor textarea {
  width: 100%; height: 480px; font-family: Consolas, "Cascadia Mono", monospace; font-size: 13px;
  background: #0a0c10; resize: vertical; line-height: 1.5;
}
.settings-form { display: grid; grid-template-columns: 240px 1fr; gap: 11px 16px; align-items: center; max-width: 720px; }
.settings-form label { color: var(--muted); font-size: 13px; }
.clean-output {
  background: #0a0c10; border: 1px solid var(--border); border-radius: var(--radius-s);
  padding: 11px; color: var(--amber);
  font-family: Consolas, monospace; font-size: 12px; white-space: pre-wrap;
}

/* ---------------- activity chart ---------------- */
.chart { display: flex; align-items: flex-end; gap: 7px; height: 170px; padding-top: 8px; }
.chart .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; height: 100%; min-width: 0; }
.chart .bar-wrap { flex: 1; width: 100%; display: flex; align-items: flex-end; }
.chart .bar {
  width: 100%; min-height: 2px; border-radius: 5px 5px 2px 2px;
  background: linear-gradient(180deg, var(--accent-h), var(--accent));
  transition: height .3s;
}
.chart .col:hover .bar { background: var(--accent-h); }
.chart .day { font-size: 10px; color: var(--muted); white-space: nowrap; }
.chart .cnt { font-size: 10.5px; color: var(--fg); font-weight: 700; height: 12px; }

/* ---------------- auth pages ---------------- */
body.auth {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(600px 300px at 20% 10%, rgba(79, 124, 255, .08), transparent),
    radial-gradient(500px 300px at 85% 85%, rgba(139, 92, 246, .07), transparent),
    var(--bg);
}
.auth-box { width: 370px; padding: 30px 28px; }
.auth-box .brand { justify-content: center; padding-bottom: 6px; }
.auth-form { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.auth-form label { color: var(--muted); font-size: 12px; margin-top: 6px; font-weight: 600; }
.auth-form .btn { margin-top: 14px; justify-content: center; }

.user-tag {
  background: var(--panel2); border-radius: 6px; padding: 4px 10px;
  color: var(--fg); font-size: 13px;
}

/* ---------------- responsive ---------------- */
@media (max-width: 940px) {
  body { display: block; }
  .sidebar {
    position: static; width: auto; flex-direction: row; align-items: center;
    overflow-x: auto; padding: 10px; border-right: none; border-bottom: 1px solid var(--border);
  }
  .brand { padding: 4px 8px; }
  nav { flex-direction: row; }
  nav a { padding: 7px 10px; white-space: nowrap; }
  nav a span { display: none; }
  .sidebar .bottom { margin: 0 0 0 auto; padding: 0; border: none; }
  .main-wrap { margin-left: 0; }
  .editors { grid-template-columns: 1fr; }
}
