/* ==========================================================================
   SECURE MAIL CONSOLE - SLEEK LIGHT BLACK (DARK) THEME
   Tailored for High Deliverability & Anti-Spam Protection
   ========================================================================== */

:root {
  --bg-base: #0f1117;
  --bg-card: #161922;
  --bg-card-subtle: #1c202c;
  --bg-input: #0d0f15;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-card: #222735;
  --border-focus: #3b82f6;
  
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #64748b;
  --text-dim: #4b5563;

  --accent-blue: #3b82f6;
  --accent-blue-soft: rgba(59, 130, 246, 0.15);
  --accent-green: #10b981;
  --accent-green-soft: rgba(16, 185, 129, 0.15);
  --accent-amber: #f59e0b;
  --accent-amber-soft: rgba(245, 158, 11, 0.15);
  --accent-red: #ef4444;
  --accent-red-soft: rgba(239, 68, 68, 0.15);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text-primary);
  background-color: var(--bg-base);
  font-size: 13.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: 'Outfit', 'Inter', sans-serif;
  letter-spacing: -0.01em;
}

button, input, textarea {
  font: inherit;
}

a {
  color: var(--accent-blue);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

.app {
  min-height: 100vh;
  background: radial-gradient(circle at 50% 0%, #161b28 0%, #0d0f15 70%);
}

/* ==================== TOP NAVIGATION BAR ==================== */
.topbar {
  height: 52px;
  background: rgba(15, 17, 23, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-inner {
  max-width: 1400px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.version-tag {
  font-size: 10px;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 2px 7px;
  border-radius: 999px;
  font-weight: 600;
}

.spam-shield-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-green-soft);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px 24px 40px;
}

/* ==================== HERO SECTION ==================== */
.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 14px;
  padding: 18px 24px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.logo {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  display: grid;
  place-items: center;
  font-size: 22px;
  color: #fff;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
  flex-shrink: 0;
}

.brand h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.1;
  color: var(--text-primary);
  font-weight: 700;
}

.brandline {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--accent-blue-soft);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.3);
  font-size: 11px;
  font-weight: 600;
}

.subtitle {
  margin-top: 5px;
  color: var(--text-secondary);
  font-size: 12.5px;
}

.timebox {
  display: flex;
  align-items: center;
  gap: 14px;
  white-space: nowrap;
  font-size: 12.5px;
  color: var(--text-secondary);
}

.time {
  display: flex;
  align-items: center;
  gap: 6px;
}

.time strong {
  color: var(--text-primary);
}

.divider {
  color: var(--border-card);
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  display: inline-block;
}

.work {
  color: #34d399;
  background: var(--accent-green-soft);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* ==================== STRATEGY BANNER ==================== */
.strategy {
  margin-top: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 14px;
  padding: 14px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.strategy-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.shield {
  width: 44px;
  height: 44px;
  border-radius: 11px;
  background: linear-gradient(135deg, #10b981, #059669);
  display: grid;
  place-items: center;
  font-size: 20px;
  color: #fff;
  flex: none;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

.strategy h2 {
  margin: 0;
  font-size: 16px;
  color: var(--text-primary);
  font-weight: 700;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.strategy p {
  margin: 3px 0 0;
  color: var(--text-secondary);
  font-size: 12.5px;
}

.tag {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
  border-radius: 6px;
  padding: 3px 7px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.rules {
  border: 1px solid var(--border-card);
  background: var(--bg-card-subtle);
  border-radius: 8px;
  padding: 8px 14px;
  color: var(--text-primary);
  min-width: 140px;
  cursor: pointer;
  font-weight: 600;
  font-size: 12px;
  transition: all .15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.rules:hover {
  background: #252b3b;
  border-color: var(--accent-blue);
  color: #60a5fa;
}

/* 5 Rules Dropdown */
.rules-box {
  margin-top: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 12px;
  padding: 16px 20px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.rules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}

.rule-item {
  display: flex;
  gap: 11px;
  align-items: flex-start;
}

.rule-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent-blue-soft);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
  font-weight: 700;
  font-size: 11px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.rule-content strong {
  font-size: 12.5px;
  color: var(--text-primary);
  display: block;
}

.rule-content p {
  font-size: 11.5px;
  color: var(--text-secondary);
  margin: 3px 0 0;
  line-height: 1.4;
}

/* ==================== DASHBOARD GRID ==================== */
.dashboard {
  display: grid;
  grid-template-columns: 1.15fr 0.95fr;
  gap: 18px;
  margin-top: 16px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

.cardhead {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.cardtitle {
  display: flex;
  gap: 12px;
  align-items: center;
}

.cardicon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-subtle);
  display: grid;
  place-items: center;
  font-size: 15px;
  flex: none;
}

.step-badge {
  background: linear-gradient(135deg, #1e3a8a, #2563eb);
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  border: none;
  box-shadow: 0 3px 10px rgba(37, 99, 235, 0.3);
}

.card h3 {
  margin: 0;
  font-size: 16px;
  color: var(--text-primary);
  font-weight: 700;
}

.cardhead p {
  margin: 3px 0 0;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.4;
}

.help {
  color: #60a5fa;
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  text-align: right;
  line-height: 1.3;
  transition: color .15s;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.help:hover {
  color: #93c5fd;
  text-decoration: underline;
}

/* Password Guide Box */
.password-guide-box {
  background: var(--bg-card-subtle);
  border: 1px solid #2b3346;
  border-radius: 10px;
  padding: 13px 16px;
  margin-bottom: 16px;
  font-size: 12px;
  color: var(--text-secondary);
}

.guide-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  color: #60a5fa;
}

.guide-header strong {
  display: flex;
  align-items: center;
  gap: 6px;
}

.password-guide-box ol {
  margin: 0;
  padding-left: 18px;
  line-height: 1.6;
}

.password-guide-box strong {
  color: var(--text-primary);
}

/* Forms & Fields */
.formgrid {
  display: grid;
  grid-template-columns: 1fr 1.2fr 1.1fr;
  gap: 14px;
}

.field label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.req {
  color: var(--accent-red);
}

.opt {
  color: var(--text-muted);
  font-weight: normal;
  font-size: 11px;
}

input, textarea {
  width: 100%;
  border: 1px solid var(--border-card);
  border-radius: 8px;
  background: var(--bg-input);
  color: var(--text-primary);
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
  padding: 9px 12px;
  font-size: 13px;
}

input {
  height: 40px;
}

textarea {
  min-height: 160px;
  resize: vertical;
  line-height: 1.5;
}

input::placeholder, textarea::placeholder {
  color: #4b5568;
}

input:focus, textarea:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

input:disabled, textarea:disabled {
  background: #11141c;
  color: #4b5563;
  cursor: not-allowed;
  border-color: #1a1e28;
}

.hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 5px;
  line-height: 1.3;
}

.char-pill {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

.password-wrap {
  position: relative;
}

.password-wrap input {
  padding-right: 36px;
}

.eye {
  position: absolute;
  right: 11px;
  top: 11px;
  color: var(--text-muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 14px;
  transition: color .15s;
}

.eye:hover {
  color: var(--accent-blue);
}

/* ==================== STEP 2: SUBJECT & SPAM ANALYZER ==================== */
.section-divider {
  height: 1px;
  background: var(--border-card);
  margin: 18px 0 16px 0;
}

.sub-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.sub-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.score {
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 11.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  transition: all .2s ease;
}

.score-excellent {
  background: var(--accent-green-soft);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.score-warning {
  background: var(--accent-amber-soft);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.score-danger {
  background: var(--accent-red-soft);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.template {
  margin-top: 12px;
  border: 1px solid var(--border-card);
  border-radius: 10px;
  padding: 12px;
  background: var(--bg-card-subtle);
}

.template-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 9px;
  display: flex;
  align-items: center;
  gap: 7px;
}

.template-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.template button {
  border: 1px solid #2b3346;
  background: #151821;
  border-radius: 7px;
  padding: 7px 12px;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 11.5px;
  font-weight: 500;
  transition: all .15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.template button:hover {
  background: #1c2230;
  border-color: var(--accent-blue);
  color: #60a5fa;
  transform: translateY(-1px);
}

.message {
  margin-top: 16px;
}

/* Live Spam Warning Box */
.spam-alert-box {
  margin-top: 12px;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 9px;
  padding: 10px 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: #fbbf24;
  font-size: 12px;
}

.spam-alert-content strong {
  display: block;
  font-size: 12px;
  color: #fde68a;
  margin-bottom: 2px;
}

.spam-alert-content span {
  color: #f3f4f6;
  font-size: 11.5px;
  line-height: 1.4;
}

/* Turnstile Box */
.turnstile {
  margin-top: 16px;
  border: 1px solid var(--border-card);
  border-radius: 9px;
  padding: 12px 14px;
  background: var(--bg-card-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.turnstile-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.check {
  width: 26px;
  height: 26px;
  border: 1px solid #2b3346;
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: var(--bg-input);
  flex-shrink: 0;
}

.turnstile-title {
  font-weight: 600;
  color: var(--text-primary);
  display: block;
  font-size: 12px;
}

.turnstile-sub {
  font-size: 11px;
  color: var(--text-muted);
}

/* ==================== RECIPIENTS CARD & SAFEGUARDS ==================== */
.recipient-card {
  margin-bottom: 18px;
}

.counter {
  font-size: 11.5px;
  color: #60a5fa;
  background: var(--accent-blue-soft);
  border: 1px solid rgba(59, 130, 246, 0.25);
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 600;
}

.recipient-box {
  min-height: 115px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  background: var(--bg-input);
  color: #e2e8f0;
}

.error-banner {
  background: var(--accent-red-soft);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 8px 12px;
  border-radius: 7px;
  font-size: 11.5px;
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 7px;
}

/* Anti-Spam Safeguards Switchboard */
.safeguards-box {
  margin-top: 14px;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-card);
  border-radius: 10px;
  padding: 12px 14px;
}

.safeguards-header {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 10px;
}

.toggle-control {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  margin-bottom: 10px;
  cursor: pointer;
  user-select: none;
}
.toggle-control:last-child {
  margin-bottom: 0;
}

.toggle-control input {
  display: none;
}

.toggle-slider {
  width: 34px;
  height: 20px;
  background: #252b3b;
  border: 1px solid #363e52;
  border-radius: 999px;
  position: relative;
  flex-shrink: 0;
  transition: background .2s ease;
  margin-top: 2px;
}

.toggle-slider::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  transition: transform .2s ease;
}

.toggle-control input:checked + .toggle-slider {
  background: var(--accent-green);
  border-color: #059669;
}

.toggle-control input:checked + .toggle-slider::after {
  transform: translateX(14px);
}

.toggle-label strong {
  display: block;
  font-size: 12px;
  color: var(--text-primary);
}

.toggle-label small {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.3;
}

/* ==================== PROGRESS CARD ==================== */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 14px;
}

.stat {
  border: 1px solid var(--border-card);
  border-radius: 9px;
  padding: 12px 8px;
  text-align: center;
  background: var(--bg-card-subtle);
  transition: transform .15s ease, border-color .15s ease;
}

.stat:hover {
  transform: translateY(-2px);
  border-color: #31384b;
}

.stat small {
  display: block;
  text-transform: uppercase;
  font-size: 9px;
  letter-spacing: .6px;
  color: var(--text-muted);
  font-weight: 700;
}

.stat strong {
  display: block;
  margin-top: 5px;
  font-size: 24px;
  line-height: 1;
  font-weight: 800;
  font-family: 'Outfit', sans-serif;
}

.total strong { color: #60a5fa; }
.sent strong { color: #34d399; }
.failed strong { color: #f87171; }
.remaining strong { color: #fbbf24; }

.progressbar {
  height: 8px;
  border-radius: 99px;
  background: #11141c;
  border: 1px solid var(--border-card);
  overflow: hidden;
  margin: 14px 0 10px;
}

.progressbar span {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #10b981, #34d399);
  border-radius: inherit;
  transition: width .3s ease;
}

.status {
  text-align: center;
  color: var(--text-secondary);
  font-size: 12px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.text-muted { color: #64748b; }
.text-primary { color: #60a5fa; }
.text-success { color: #34d399; }
.text-danger { color: #f87171; }
.text-warning { color: #fbbf24; }

.action-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.send {
  width: 100%;
  height: 44px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all .15s ease;
}

.send:hover:not(:disabled) {
  filter: brightness(1.08);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.35);
  transform: translateY(-1px);
}

.send:disabled {
  opacity: .65;
  cursor: not-allowed;
  transform: none;
}

.stop {
  width: 100%;
  height: 44px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all .15s ease;
}

.stop:hover:not(:disabled) {
  filter: brightness(1.08);
}

/* ==================== PASSWORD GATE OVERLAY ==================== */
.password-gate {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 12, 17, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 16px;
}

.gate-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 16px;
  padding: 32px 28px;
  width: 100%;
  max-width: 400px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
}

.gate-logo {
  margin: 0 auto 16px auto;
  width: 56px;
  height: 56px;
  font-size: 24px;
}

.gate-card h2 {
  font-size: 22px;
  color: var(--text-primary);
  margin: 0 0 6px 0;
  font-weight: 700;
}

.gate-card p {
  color: var(--text-secondary);
  font-size: 13px;
  margin: 0 0 18px 0;
}

.gate-error {
  background: var(--accent-red-soft);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 7px;
  animation: shake 0.35s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.gate-unlocked {
  opacity: 0;
  transition: opacity .4s ease;
  pointer-events: none;
}

.hidden {
  display: none !important;
}

/* ==================== RESPONSIVE DESIGN ==================== */
@media (max-width: 1100px) {
  .timebox {
    display: none;
  }
  .dashboard {
    grid-template-columns: 1fr;
  }
  .formgrid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 700px) {
  .container {
    padding: 14px;
  }
  .hero, .strategy {
    padding: 16px;
    align-items: flex-start;
  }
  .brand h1 {
    font-size: 21px;
  }
  .logo {
    width: 44px;
    height: 44px;
    font-size: 18px;
  }
  .strategy {
    flex-direction: column;
  }
  .strategy-left {
    align-items: flex-start;
  }
  .tag {
    display: inline-block;
    margin: 4px 0 0;
  }
  .rules {
    width: 100%;
  }
  .formgrid {
    grid-template-columns: 1fr;
  }
  .stats {
    grid-template-columns: 1fr 1fr;
  }
  .card {
    padding: 16px;
  }
}
