:root{
  --bg: #f6f7f9;
  --card: #ffffff;
  --border: #dfe3e8;
  --text: #1f2430;
  --muted: #5f6b7a;
  --accent: #2e5aac;
  --accent-dark: #1f3f80;
  --danger: #b3261e;
  --danger-bg: #fdecea;

  --term-bg: #0c0f0a;
  --term-green: #4cff6b;
  --term-dim: #2f8f42;
}

*{ box-sizing: border-box; }

body{
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.view-switcher{
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 16px 16px 0;
}

.tab-btn{
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 9px 18px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--muted);
  cursor: pointer;
}

.tab-btn:hover{ color: var(--text); }

.tab-btn.active{
  background: var(--text);
  border-color: var(--text);
  color: #fff;
}

.stage{
  display: flex;
  gap: 28px;
  align-items: flex-start;
  justify-content: center;
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 24px 48px;
  flex-wrap: wrap;
}

.panel{ width: 100%; }

.inbox-panel{ display: none; }

.stage.view-email .inbox-panel{ display: block; max-width: 760px; }
.stage.view-email .login-panel{ display: none; }
.stage.view-email .terminal-panel{ display: none; }

.stage.view-login .login-panel{ display: block; max-width: 400px; }
.stage.view-login .terminal-panel{ display: none; }

.stage.view-terminal .login-panel{ display: none; }
.stage.view-terminal .terminal-panel{ display: block; max-width: 760px; }

.stage.view-split .login-panel{ display: block; max-width: 400px; }
.stage.view-split .terminal-panel{ display: block; max-width: 480px; }

.panel-heading{
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .3px;
  color: var(--muted);
  margin-bottom: 10px;
}

.terminal-heading{ color: var(--term-dim); }

.mail-client{
  display: flex;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(30,30,30,.06);
  min-height: 420px;
}

.mail-sidebar{
  width: 160px;
  flex-shrink: 0;
  background: #fafbfc;
  border-right: 1px solid var(--border);
  padding: 18px 14px;
}

.mail-brand{
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 20px;
}

.brand-mark.small{ width: 24px; height: 24px; font-size: 12px; border-radius: 6px; }

.mail-folders{
  list-style: none;
  margin: 0; padding: 0;
  font-size: 13.5px;
}

.mail-folders li{
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--muted);
  margin-bottom: 2px;
}

.mail-folders li.active{
  background: #eef2fa;
  color: var(--accent-dark);
  font-weight: 600;
}

.mail-main{ flex: 1; min-width: 0; }

.mail-list{ display: block; }

.mail-row{
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
  cursor: pointer;
}

.mail-row:hover{ background: #f8f9fb; }

.mail-sender{ width: 150px; flex-shrink: 0; font-weight: 600; color: var(--text); }
.mail-subject-preview{
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
}
.mail-subject-preview strong{ color: var(--text); font-weight: 600; }
.mail-time{ flex-shrink: 0; color: var(--muted); font-size: 12.5px; }

.mail-reading{ display: none; padding: 20px 26px 26px; }

.back-link{
  background: none;
  border: none;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 0 0 18px;
  font-family: inherit;
}
.back-link:hover{ text-decoration: underline; }

.mail-detail-subject{ font-size: 17px; font-weight: 600; margin: 0 0 14px; }

.mail-detail-meta{
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  font-size: 13px;
  color: var(--muted);
}

.mail-avatar{
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
  flex-shrink: 0;
}

.mail-detail-body{ font-size: 14.5px; line-height: 1.65; color: var(--text); }
.mail-detail-body p{ margin: 0 0 14px; }

.phishing-link{
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
  font-weight: 600;
}
.phishing-link:hover{ color: var(--accent-dark); }

.login-panel{ position: relative; }

.login-card{
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 38px 34px 30px;
  box-shadow: 0 2px 10px rgba(30,30,30,.06);
}

.brand-row{
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
  justify-content: center;
}

.brand-mark{
  width: 34px; height: 34px;
  border-radius: 8px;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 16px;
}

.brand-name{ font-size: 20px; font-weight: 600; color: #3c4043; }

.login-card h1{ font-size: 21px; font-weight: 500; margin: 0 0 6px; }
.login-card p.sub{ margin: 0 0 26px; color: var(--muted); font-size: 14px; }

.field{ margin-bottom: 18px; }
.field label{ display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input{
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 15px;
  outline: none;
}
.field input:focus{
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(46,90,172,.15);
}

.login-actions{ display: flex; justify-content: flex-end; margin-top: 26px; }

.primary-btn{
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 11px 22px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.primary-btn:hover{ background: var(--accent-dark); }

.demo-footnote{
  margin: 22px 0 0;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

.compromised-overlay{
  display: none;
  position: absolute;
  inset: 0;
  background: rgba(20,20,22,.55);
  align-items: center;
  justify-content: center;
  padding: 16px;
  border-radius: 10px;
}

.compromised-overlay.visible{ display: flex; }

.compromised-box{
  background: var(--card);
  border: 1px solid var(--danger);
  border-radius: 10px;
  padding: 26px 26px 22px;
  max-width: 340px;
  box-shadow: 0 8px 30px rgba(0,0,0,.3);
}

.compromised-tag{
  display: inline-block;
  background: var(--danger);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 4px;
  margin-bottom: 10px;
  letter-spacing: .3px;
}

.compromised-box h2{
  margin: 0 0 12px;
  font-size: 18px;
  color: var(--danger);
}

.compromised-box p{
  margin: 0 0 18px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text);
}

.secondary-btn{
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 18px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}
.secondary-btn:hover{ background: #f2f2f2; }

/* ==========================================================================
   Terminal panel
   ========================================================================== */
.terminal{
  background: var(--term-bg);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0,0,0,.35);
  border: 1px solid #1d2417;
}

.terminal-bar{
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 14px;
  background: #161b11;
}

.term-dot{ width: 10px; height: 10px; border-radius: 50%; }
.term-dot.r{ background: #ff5f56; }
.term-dot.y{ background: #ffbd2e; }
.term-dot.g{ background: #27c93f; }

.terminal-title{
  margin-left: 10px;
  font-family: Consolas, monospace;
  font-size: 12px;
  color: #8a988a;
}

.terminal-body{
  font-family: Consolas, monospace;
  font-size: 14px;
  line-height: 1.7;
  padding: 18px 18px 20px;
  min-height: 320px;
  max-height: 480px;
  overflow-y: auto;
  color: var(--term-dim);
}

.term-line{ white-space: pre-wrap; word-break: break-all; }
.term-sys{ color: #5a6b57; }
.term-hit{ color: var(--term-green); font-weight: 700; }
.term-live-field{ color: #d8d8d8; }

.term-cursor{
  display: inline-block;
  width: 7px; height: 14px;
  background: var(--term-green);
  vertical-align: middle;
  margin-left: 2px;
  animation: blink 1s steps(1) infinite;
}

@keyframes blink{ 50%{ opacity: 0; } }

.reset-btn{ display: block; margin: 14px auto 0; }

@media (max-width: 640px){
  .stage.view-split{ flex-direction: column; align-items: center; }
  .stage.view-split .login-panel,
  .stage.view-split .terminal-panel{ max-width: 100%; }

  .mail-client{ flex-direction: column; }
  .mail-sidebar{ width: 100%; border-right: none; border-bottom: 1px solid var(--border); }
}
