/* Module 4 — First Contact Workflow */
.m04 {
  position: fixed; inset: 0; z-index: 100;
  background: linear-gradient(180deg, #07060f 0%, #0a0a1a 100%);
  color: var(--text, #f5f4ef);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.m04-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 1.4rem 2rem 1rem;
  border-bottom: 0.5px solid rgba(255, 255, 255, 0.06);
}
.m04-eyebrow {
  font-family: 'Inter', sans-serif; font-size: 0.72rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.18em;
  color: var(--gold-bright, #c9b46f); margin: 0 0 0.4rem;
}
.m04-title {
  font-family: 'Newsreader', serif; font-size: 1.6rem; font-weight: 500;
  letter-spacing: -0.02em; margin: 0;
}

/* Beat 1 intro */
.m04-intro-stage { flex: 1; display: flex; align-items: center; justify-content: center; padding: 2rem; }
.m04-intro-card {
  max-width: 520px; padding: 2rem;
  background: rgba(255, 255, 255, 0.03);
  border: 0.5px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px; text-align: center;
}
.m04-portrait { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; border: 1px solid rgba(255, 255, 255, 0.12); margin: 0 auto 0.8rem; }
.m04-portrait-role { color: rgba(255, 255, 255, 0.45); margin: 0.2rem 0 1.6rem; font-size: 0.85rem; }
.m04-controls { display: flex; flex-direction: column; gap: 0.7rem; align-items: center; margin-bottom: 1rem; }
.m04-progress { width: 100%; height: 3px; background: rgba(255, 255, 255, 0.08); border-radius: 2px; overflow: hidden; }
.m04-progress span { display: block; height: 100%; background: var(--gold-bright, #c9b46f); width: 0%; transition: width 0.2s linear; }
.m04-intro-quote { font-family: 'Newsreader', serif; color: rgba(255, 255, 255, 0.7); font-size: 0.95rem; line-height: 1.55; }

/* Beat 2 CMS */
.m04-cms-frame {
  flex: 1; margin: 1.5rem 2rem; overflow-y: auto;
  background: #f3f1eb; color: #1a1a1a; border-radius: 10px;
  border: 0.5px solid rgba(255, 255, 255, 0.08);
  display: flex; flex-direction: column;
}
.m04-cms-chrome {
  display: flex; align-items: center; gap: 0.4rem;
  padding: 0.6rem 1rem; background: #e8e5dd; border-bottom: 1px solid #d4d0c5;
}
.m04-cms-dot { width: 11px; height: 11px; border-radius: 50%; }
.m04-cms-dot--red { background: #ed6a5e; }
.m04-cms-dot--yellow { background: #f5bf4f; }
.m04-cms-dot--green { background: #62c554; }
.m04-cms-url { margin-left: 0.8rem; font-size: 0.78rem; color: #6b6962; font-family: 'SF Mono', Menlo, monospace; }
.m04-cms-body { padding: 1.5rem 2rem; flex: 1; }
.m04-cms-banner {
  background: linear-gradient(120deg, #fff8e0, #fef0c8); border-left: 3px solid #c9a62b;
  padding: 0.8rem 1rem; border-radius: 4px; margin-bottom: 1.5rem;
}
.m04-cms-banner .m04-eyebrow { color: #6b5a10; }
.m04-cms-banner-sub { color: #4d4a40; font-size: 0.85rem; margin: 0.3rem 0 0; }
.m04-referral { background: white; border: 1px solid #d4d0c5; border-radius: 6px; padding: 1.4rem; }
.m04-referral-name { font-family: 'Newsreader', serif; font-size: 1.5rem; margin: 0 0 0.2rem; color: #1a1a1a; letter-spacing: -0.02em; }
.m04-referral-meta { color: #6b6962; font-size: 0.85rem; margin: 0 0 1rem; }
.m04-referral-facts { display: grid; grid-template-columns: 180px 1fr; gap: 0.4rem 1rem; font-size: 0.88rem; margin: 0; }
.m04-referral-facts dt { color: #6b6962; text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.72rem; padding-top: 0.15rem; }
.m04-referral-facts dd { margin: 0; color: #1a1a1a; }
.m04-hot {
  background: rgba(201, 166, 43, 0.18); border: 1px dashed rgba(201, 166, 43, 0.55);
  color: #5d4d10; padding: 0.1rem 0.5rem; border-radius: 4px; cursor: pointer;
  font-family: inherit; font-size: inherit;
}
.m04-hot.is-visited { background: rgba(98, 197, 84, 0.18); border-color: rgba(98, 197, 84, 0.55); color: #1f5610; }
.m04-hot--alert { background: rgba(237, 106, 94, 0.18); border-color: rgba(237, 106, 94, 0.55); color: #6b1a14; }
.m04-cms-actions { margin-top: 2rem; display: flex; flex-direction: column; align-items: flex-start; gap: 0.4rem; }
.m04-cms-actions-hint { color: #6b6962; font-size: 0.78rem; margin: 0; }

.m04-popover {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(440px, 90vw); padding: 1.6rem;
  background: rgba(15, 15, 28, 0.97); color: var(--text, #f5f4ef);
  border: 0.5px solid rgba(255, 255, 255, 0.12); border-radius: 12px;
  z-index: 1000; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}
.m04-pop-body { margin: 0.4rem 0 1rem; line-height: 1.55; color: rgba(255, 255, 255, 0.85); }

/* Beat 3 portal / rhythm */
.m04-portal-frame {
  flex: 1; margin: 1.5rem 2rem; overflow-y: auto;
  background: #fff; color: #1a1a1a; border-radius: 10px;
  border: 0.5px solid rgba(255, 255, 255, 0.08);
}
.m04-portal-body { padding: 1.5rem 2rem; }
.m04-portal-h { font-family: 'Newsreader', serif; font-size: 1.5rem; margin: 0.2rem 0 0.4rem; letter-spacing: -0.02em; color: #1a1a1a; }
.m04-portal-sub { color: #6b6962; margin: 0 0 1.4rem; font-size: 0.92rem; }
.m04-rhythm-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.6rem; margin-bottom: 1.4rem; }
.m04-rhythm-step {
  background: #f3f1eb; border: 1.5px solid #d4d0c5; border-radius: 8px;
  padding: 1.2rem 1rem; cursor: pointer; transition: all 0.2s;
  display: flex; flex-direction: column; gap: 0.4rem; align-items: flex-start;
  font-family: inherit;
}
.m04-rhythm-step:hover:not(:disabled) { border-color: #c9a62b; background: #fff8e0; }
.m04-rhythm-step:disabled { opacity: 0.4; cursor: not-allowed; }
.m04-rhythm-step.is-done { background: rgba(98, 197, 84, 0.15); border-color: rgba(98, 197, 84, 0.55); }
.m04-rhythm-num { font-family: 'Newsreader', serif; font-size: 1.6rem; color: #c9a62b; }
.m04-rhythm-label { font-size: 0.85rem; color: #1a1a1a; }
.m04-portal-result { background: #f3f1eb; padding: 1rem 1.4rem; border-radius: 6px; margin-bottom: 1rem; }
.m04-portal-result.hidden { display: none; }
.m04-portal-result dl { display: grid; grid-template-columns: 200px 1fr; gap: 0.3rem 1rem; margin: 0; font-size: 0.88rem; }
.m04-portal-result dt { color: #6b6962; text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.72rem; padding-top: 0.15rem; }
.m04-portal-result dd { margin: 0; color: #1a1a1a; }
.m04-portal-result dd.ok { color: #1f5610; font-weight: 600; }
.m04-rhythm-timer { padding-top: 1rem; }
.m04-rhythm-bar { width: 100%; height: 4px; background: #f3f1eb; border-radius: 2px; overflow: hidden; }
.m04-rhythm-bar span { display: block; height: 100%; background: #c9a62b; width: 0%; transition: width 0.15s linear; }
.m04-rhythm-hint { color: #6b6962; font-size: 0.82rem; margin: 0.5rem 0 0; }

/* Marisol callout overlay */
.m04-marisol-pop {
  position: fixed; bottom: 24px; right: 24px; width: 360px;
  display: grid; grid-template-columns: 56px 1fr; gap: 0.8rem;
  padding: 1rem 1.2rem;
  background: rgba(15, 15, 28, 0.97); color: var(--text, #f5f4ef);
  border: 0.5px solid rgba(201, 180, 111, 0.4); border-radius: 12px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  z-index: 2000;
  animation: m04-pop-in 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}
@keyframes m04-pop-in { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.m04-marisol-pop.is-leaving { opacity: 0; transition: opacity 0.4s; }
.m04-marisol-pop-img { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; }
.m04-marisol-pop-text { font-family: 'Newsreader', serif; font-size: 0.92rem; line-height: 1.5; margin: 0.2rem 0 0; color: rgba(255, 255, 255, 0.9); }

/* Beat 4 calendar */
.m04-cal-stage { flex: 1; display: grid; grid-template-columns: 280px 1fr; gap: 1.5rem; padding: 1.5rem 2rem; overflow: hidden; }
.m04-cal-side { display: flex; flex-direction: column; gap: 1rem; overflow-y: auto; }
.m04-objective { background: rgba(255, 255, 255, 0.03); border: 0.5px solid rgba(255, 255, 255, 0.08); border-radius: 8px; padding: 1rem 1.2rem; }
.m04-objective p { margin: 0; font-size: 0.92rem; line-height: 1.55; color: rgba(255, 255, 255, 0.78); }
.m04-objective-hint { color: var(--gold-bright, #c9b46f); font-size: 0.82rem !important; margin-top: 0.6rem !important; }
.m04-cal-counters { font-family: 'Newsreader', serif; font-size: 1.2rem; color: rgba(255, 255, 255, 0.85); }
.m04-cal-counters strong { color: var(--gold-bright, #c9b46f); }
.m04-attempts-pool { display: flex; flex-direction: column; gap: 0.5rem; }
.m04-attempt {
  padding: 0.8rem 1rem; text-align: left;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px; cursor: pointer; color: var(--text, #f5f4ef);
  font-family: inherit; font-size: 0.92rem;
}
.m04-attempt:hover { border-color: var(--gold-bright, #c9b46f); }
.m04-attempt.is-selected { background: rgba(201, 180, 111, 0.18); border-color: var(--gold-bright, #c9b46f); }
.m04-attempt.is-placed { opacity: 0.4; }
.m04-cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 0.4rem;
  overflow-y: auto; padding-right: 0.4rem; align-content: start;
}
.m04-cal-day {
  position: relative;
  background: rgba(255, 255, 255, 0.03);
  border: 0.5px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px; padding: 0.7rem 0.5rem; min-height: 88px;
  cursor: pointer; text-align: left; color: inherit; font-family: inherit;
  display: flex; flex-direction: column; gap: 0.2rem;
}
.m04-cal-day:hover { border-color: rgba(201, 180, 111, 0.4); }
.m04-cal-day.is-cadence { background: rgba(201, 180, 111, 0.08); border-color: rgba(201, 180, 111, 0.3); }
.m04-cal-day.is-outside { opacity: 0.3; }
.m04-cal-day-dow { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.1em; color: rgba(255, 255, 255, 0.45); margin: 0; }
.m04-cal-day-num { font-family: 'Newsreader', serif; font-size: 1.2rem; margin: 0; }
.m04-cal-day-tag { font-size: 0.6rem; color: var(--gold-bright, #c9b46f); margin: 0; }
.m04-cal-day-att {
  font-size: 0.62rem; color: var(--gold-bright, #c9b46f); margin: 0.2rem 0 0;
  background: rgba(0, 0, 0, 0.4); padding: 0.15rem 0.4rem; border-radius: 3px;
  align-self: flex-start;
}
.m04-cal-day.is-correct { background: rgba(98, 197, 84, 0.12); border-color: rgba(98, 197, 84, 0.45); }
.m04-cal-day.is-off { background: rgba(237, 106, 94, 0.08); border-color: rgba(237, 106, 94, 0.3); }
.m04-cal-day.is-off .m04-cal-day-att { color: #ed6a5e; }

/* Beat 5 DAP */
.m04-dap-stage { flex: 1; display: grid; grid-template-columns: 1fr 320px; gap: 1.5rem; padding: 1.5rem 2rem; overflow: hidden; }
.m04-dap-editor { display: flex; flex-direction: column; gap: 1rem; overflow-y: auto; padding-right: 0.4rem; }
.m04-dap-section {
  background: rgba(255, 255, 255, 0.03); border: 0.5px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px; padding: 1rem 1.2rem;
}
.m04-dap-hint { color: rgba(255, 255, 255, 0.55); font-size: 0.82rem; margin: 0.2rem 0 0.6rem; }
.m04-dap-editor textarea {
  width: 100%; min-height: 110px; padding: 0.8rem;
  background: rgba(0, 0, 0, 0.25); color: var(--text, #f5f4ef);
  border: 0.5px solid rgba(255, 255, 255, 0.12); border-radius: 6px;
  font-family: 'SF Mono', Menlo, monospace; font-size: 0.85rem; line-height: 1.55;
  resize: vertical;
}
.m04-dap-editor textarea:focus { outline: none; border-color: var(--gold-bright, #c9b46f); }
.m04-dap-actions { display: flex; gap: 0.6rem; }
.m04-dap-error {
  background: rgba(237, 106, 94, 0.15); border: 1px solid rgba(237, 106, 94, 0.4);
  padding: 0.8rem 1rem; border-radius: 6px; color: #f8b1a8; margin: 0;
}
.m04-dap-side {
  background: rgba(255, 255, 255, 0.03); border: 0.5px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px; padding: 1rem 1.2rem; overflow-y: auto;
}
.m04-dap-side h4 { font-family: 'Newsreader', serif; font-size: 1rem; margin: 1rem 0 0.4rem; color: var(--gold-bright, #c9b46f); }
.m04-dap-side ul { font-size: 0.85rem; color: rgba(255, 255, 255, 0.78); padding-left: 1.2rem; line-height: 1.5; margin: 0.4rem 0; }

/* Beat 6 evening */
.m04-evening-stage { flex: 1; display: flex; align-items: center; justify-content: center; padding: 2rem; position: relative; }
.m04-evening-bg {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  filter: brightness(0.35) blur(2px); opacity: 0.6;
}
.m04-evening-card {
  position: relative;
  max-width: 520px; padding: 2rem;
  background: rgba(15, 15, 28, 0.92);
  border: 0.5px solid rgba(255, 255, 255, 0.12); border-radius: 12px;
  backdrop-filter: blur(8px);
}
.m04-evening-tasks { padding-left: 0; list-style: none; margin: 0.4rem 0 1.4rem; }
.m04-evening-tasks li { padding: 0.6rem 0.8rem; background: rgba(255, 255, 255, 0.04); border-radius: 4px; margin: 0.3rem 0; font-size: 0.92rem; }
.m04-evening-task--later { color: rgba(255, 255, 255, 0.55); font-size: 0.82rem !important; }
.m04-evening-quote { font-family: 'Newsreader', serif; font-size: 1.05rem; line-height: 1.55; color: rgba(255, 255, 255, 0.85); margin: 1rem 0 1.4rem; }
.hidden { display: none !important; }

@media (max-width: 1100px) {
  .m04-cal-stage, .m04-dap-stage { grid-template-columns: 1fr; }
  .m04-cal-grid { grid-template-columns: repeat(7, 1fr); }
}
