#ifd-email-lab {
  --email-navy: #10253f;
  --email-blue: #176a88;
  --email-cyan: #1e9fc4;
  --email-pale: #eaf5f8;
  --email-line: #d4dde5;
  --email-text: #1d2b38;
  background: #eef2f5;
  color: var(--email-text);
  font-size: 16px;
  left: 50%;
  margin: -1.2rem 0 0 -50vw;
  min-height: calc(100vh - 4.7rem);
  position: relative;
  width: 100vw;
}

.md-main__inner:has(#ifd-email-lab),
.md-content:has(#ifd-email-lab),
.md-content__inner:has(#ifd-email-lab) { margin: 0; max-width: none; padding: 0; }
.md-content__inner:has(#ifd-email-lab)::before { display: none; }
#ifd-email-lab *, #ifd-email-lab *::before, #ifd-email-lab *::after { box-sizing: border-box; }
#ifd-email-lab button, #ifd-email-lab input, #ifd-email-lab textarea { font: inherit; }
#ifd-email-lab button { cursor: pointer; }
#ifd-email-lab button:disabled { cursor: not-allowed; opacity: .48; }
#ifd-email-lab button:focus-visible, #ifd-email-lab input:focus-visible, #ifd-email-lab a:focus-visible,
#ifd-email-lab [tabindex="-1"]:focus { outline: 3px solid #f0b429; outline-offset: 2px; }

.email-lab-top {
  align-items: center;
  background: var(--email-navy);
  color: white;
  display: flex;
  gap: 1.25rem;
  min-height: 74px;
  padding: .65rem 1.35rem;
}
.email-lab-top > div:first-child { display: grid; margin-right: auto; }
.email-lab-top a { color: #9ee5f5; font-size: .76rem; font-weight: 700; width: fit-content; }
.email-lab-top span { font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; }
.email-lab-top strong { font-size: 1rem; }
.email-lab-top > button { background: transparent; border: 1px solid #85a0b7; border-radius: .3rem; color: white; padding: .45rem .65rem; }
.overall-progress { display: grid; min-width: 62px; text-align: center; }
.overall-progress strong { font-size: 1.05rem; }

.email-workspace { display: grid; grid-template-columns: minmax(0, 65fr) minmax(340px, 35fr); height: calc(100vh - 4.7rem - 74px); min-height: 660px; }
.email-mailbox-pane { background: #dfe6eb; min-height: 0; min-width: 0; overflow: hidden; padding: 1.2rem; }
.email-task-pane { background: white; border-left: 1px solid #c6d0d8; min-height: 0; min-width: 0; overflow: hidden; }
.email-mobile-switch { display: none; }

.mail-app { background: #fff; border: 1px solid #bac7d1; border-radius: .65rem; box-shadow: 0 .7rem 2rem rgba(16,37,63,.12); height: 100%; overflow: hidden; position: relative; }
.mail-head { align-items: center; background: #f7f9fb; border-bottom: 1px solid var(--email-line); display: flex; gap: 2rem; height: 62px; padding: .75rem 1rem; }
.mail-logo { color: var(--email-navy); font-size: 1.1rem; font-weight: 800; letter-spacing: -.02em; }
.mail-head label { flex: 1; max-width: 560px; }
.mail-head input { background: #e8eef2; border: 0; border-radius: .35rem; padding: .55rem .75rem; width: 100%; }
.mail-body { display: grid; grid-template-columns: 150px 1fr; height: calc(100% - 62px); }
.mail-folders { background: #f7f9fb; border-right: 1px solid var(--email-line); display: flex; flex-direction: column; gap: .35rem; padding: 1.1rem .65rem; }
.mail-folders > strong { color: #536575; font-size: .72rem; letter-spacing: .07em; padding: 0 .55rem .4rem; text-transform: uppercase; }
.mail-folders button { background: transparent; border: 0; border-radius: .35rem; color: #33495a; display: flex; justify-content: space-between; padding: .55rem; text-align: left; }
.mail-folders button.is-current { background: #dcecf2; color: var(--email-navy); font-weight: 700; }
.inbox { min-width: 0; overflow: auto; }
.mail-title { align-items: center; border-bottom: 1px solid var(--email-line); display: flex; justify-content: space-between; padding: 1.1rem 1.2rem; }
.mail-title span { color: #687a88; font-size: .72rem; text-transform: uppercase; }
.mail-title h2 { font-size: 1.4rem; margin: .1rem 0 0; }
.mail-title button, .message-toolbar button, .draft-actions button { background: #fff; border: 1px solid #b9c6cf; border-radius: .3rem; padding: .42rem .65rem; }
.message-list { display: grid; }
.message-row { align-items: center; background: white; border: 0; border-bottom: 1px solid var(--email-line); color: var(--email-text); display: grid; gap: .75rem; grid-template-columns: 38px minmax(0,1fr) auto; padding: .9rem 1.1rem; text-align: left; width: 100%; }
.message-row.target:hover, .message-row.target:focus { background: #eef7fa; }
.message-row > span:nth-child(2) { display: grid; min-width: 0; }
.message-row span span, .message-row small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.message-row small, .message-row time { color: #667885; font-size: .75rem; }
.avatar { align-items: center; background: var(--email-blue); border-radius: 50%; color: white; display: inline-flex; font-size: .72rem; font-weight: 800; height: 36px; justify-content: center; width: 36px; }
.avatar.muted { background: #8397a6; }

.opened-message { height: calc(100% - 62px); overflow: auto; }
.message-toolbar { align-items: center; border-bottom: 1px solid var(--email-line); display: flex; justify-content: space-between; padding: .65rem 1rem; position: sticky; top: 0; background: white; z-index: 3; }
.message-toolbar > div { display: flex; gap: .45rem; }
.opened-message article { margin: 0 auto; max-width: 760px; padding: 1.5rem 1.8rem 3rem; }
.opened-message article > h2 { color: var(--email-navy); font-size: 1.35rem; margin: 0 0 1.1rem; }
.sender-line { align-items: center; display: grid; gap: .7rem; grid-template-columns: 38px 1fr auto; }
.sender-line > button { background: transparent; border: 0; display: grid; padding: .2rem; text-align: left; }
.sender-line > button span, .sender-line time { color: #667885; font-size: .74rem; }
.sender-card { background: #f2f6f8; border: 1px solid var(--email-line); border-radius: .4rem; margin: .8rem 0 0 48px; padding: .6rem .8rem; }
.sender-card dl { margin: 0; }
.sender-card dl > div { display: grid; font-size: .8rem; grid-template-columns: 55px 1fr; padding: .2rem 0; }
.sender-card dt { color: #5e707f; font-weight: 700; }
.sender-card dd { margin: 0; overflow-wrap: anywhere; }
.email-copy { color: #2b3945; line-height: 1.6; padding: 1.4rem 0 0 48px; }
.tracking-row { align-items: center; display: flex; flex-wrap: wrap; gap: .65rem; margin: 1.3rem 0; }
.fake-link { background: var(--email-blue); border-radius: .3rem; color: white; display: inline-block; font-weight: 700; padding: .7rem 1rem; }
.inspect { background: white; border: 1px solid var(--email-blue); border-radius: .3rem; color: var(--email-blue); font-weight: 700; padding: .55rem .7rem; }
.link-inspector { background: #eef7fa; border-left: 4px solid var(--email-cyan); display: grid; gap: .25rem; margin: -.4rem 0 1.2rem; overflow-wrap: anywhere; padding: .75rem; }
.link-inspector code { color: #173e51; font-size: .78rem; white-space: normal; }
.link-inspector span { color: #516775; font-size: .72rem; }
.menu-wrap { position: relative; }
.message-menu { background: white; border: 1px solid var(--email-line); border-radius: .35rem; box-shadow: 0 .5rem 1.5rem rgba(0,0,0,.14); min-width: 190px; padding: .35rem; position: absolute; right: 0; top: calc(100% + .3rem); z-index: 5; }
.message-menu button { border: 0; width: 100%; }
.reply-draft { border: 1px solid var(--email-line); border-radius: .45rem; box-shadow: 0 .3rem 1rem rgba(16,37,63,.1); margin: 1.4rem 0 0 48px; overflow: hidden; }
.draft-row { border-bottom: 1px solid var(--email-line); display: grid; font-size: .82rem; gap: .7rem; grid-template-columns: 30px 1fr; padding: .65rem .8rem; }
.reply-draft textarea { border: 0; min-height: 90px; padding: .8rem; resize: none; width: 100%; }
.draft-actions { display: flex; gap: .5rem; padding: .6rem .8rem; }
.draft-actions button:first-child { background: var(--email-blue); color: white; }
.details-modal { align-items: center; background: rgba(6,18,31,.55); display: flex; inset: 0; justify-content: center; padding: 1rem; position: absolute; z-index: 10; }
.details-modal > div { background: white; border-radius: .5rem; box-shadow: 0 1rem 3rem rgba(0,0,0,.25); max-width: 680px; padding: 1.2rem; width: 100%; }
.details-modal header span { color: #617482; font-size: .72rem; text-transform: uppercase; }
.details-modal h2 { color: var(--email-navy); margin: .15rem 0 .8rem; }
.details-modal pre { background: #eef2f5; border: 1px solid var(--email-line); font-size: .77rem; line-height: 1.65; overflow: auto; padding: .8rem; white-space: pre-wrap; }
.details-modal button { background: var(--email-blue); border: 0; border-radius: .3rem; color: white; font-weight: 700; padding: .55rem .75rem; }

.task-panel { display: grid; grid-template-rows: auto minmax(0,1fr) auto; height: 100%; }
.task-progress { align-items: center; background: #f5f8fa; border-bottom: 1px solid var(--email-line); display: grid; gap: .35rem; padding: .8rem 1.2rem; }
.task-progress span { color: #607483; font-size: .72rem; font-weight: 700; text-transform: uppercase; }
.task-progress progress { accent-color: var(--email-cyan); height: 6px; width: 100%; }
.task-scroll { overflow-y: auto; overscroll-behavior: contain; padding: 1.2rem 1.3rem 2rem; }
.task-scroll h1 { color: var(--email-navy); font-size: 1.45rem; line-height: 1.2; margin: 0 0 1rem; }
.task-scroll p, .task-scroll li { font-size: .86rem; line-height: 1.55; }
.task-scroll a { color: #075f80; font-weight: 700; }
.task-callout { background: var(--email-pale); border-left: 4px solid var(--email-cyan); margin: 1.2rem 0; padding: .8rem 1rem; }
.task-callout h3 { color: var(--email-navy); font-size: .78rem; letter-spacing: .06em; margin: 0 0 .35rem; text-transform: uppercase; }
.task-callout p { margin: .25rem 0; }
.task-question { border-top: 1px solid var(--email-line); margin-top: 1rem; padding-top: 1rem; }
.task-question > label { display: grid; gap: .35rem; }
.task-question input[type="text"], .task-question input:not([type]) { border: 1px solid #94a7b5; border-radius: .3rem; padding: .55rem; width: 100%; }
.task-question > button { background: var(--email-blue); border: 0; border-radius: .3rem; color: white; font-weight: 700; margin-top: .7rem; padding: .55rem .75rem; }
.task-question fieldset { border: 0; margin: 0; padding: 0; }
.task-question legend { font-size: .86rem; line-height: 1.5; margin-bottom: .65rem; }
.choices label { align-items: flex-start; border: 1px solid var(--email-line); border-radius: .35rem; display: flex; gap: .55rem; margin: .45rem 0; padding: .65rem; }
.choices input { margin-top: .2rem; }
.choices label span { font-size: .82rem; line-height: 1.45; }
.task-feedback { background: #edf7ef; border-left: 4px solid #3f8a52; font-size: .84rem; margin-top: .8rem; padding: .75rem .9rem; }
.task-feedback.retry { background: #fff6e3; border-color: #d38c1a; }
.task-feedback p { margin: .3rem 0; }
.task-nav { align-items: center; background: white; border-top: 1px solid var(--email-line); display: flex; gap: .65rem; justify-content: space-between; padding: .8rem 1rem; }
.task-nav button { background: white; border: 1px solid #8799a7; border-radius: .3rem; color: var(--email-navy); font-weight: 700; min-width: 90px; padding: .55rem .75rem; }
.task-nav button.primary { background: var(--email-blue); border-color: var(--email-blue); color: white; margin-left: auto; }
.completion-card { background: var(--email-pale); border-top: 4px solid var(--email-cyan); padding: 1rem; }
.completion-card h2 { color: var(--email-navy); }

@media (max-width: 1000px) {
  .email-workspace { grid-template-columns: minmax(0, 58fr) minmax(330px, 42fr); }
  .mail-body { grid-template-columns: 115px 1fr; }
  .email-mailbox-pane { padding: .75rem; }
  .opened-message article { padding-inline: 1rem; }
}

@media (max-width: 800px) {
  #ifd-email-lab { min-height: calc(100vh - 4.7rem); }
  .email-lab-top { min-height: 68px; padding: .55rem .8rem; }
  .email-lab-top > button, .overall-progress span { display: none; }
  .email-mobile-switch { background: white; border-bottom: 1px solid var(--email-line); display: grid; grid-template-columns: 1fr 1fr; padding: .4rem; }
  .email-mobile-switch button { background: white; border: 0; border-bottom: 3px solid transparent; padding: .5rem; }
  .email-mobile-switch button[aria-pressed="true"] { border-color: var(--email-cyan); color: var(--email-navy); font-weight: 800; }
  .email-workspace { display: block; height: calc(100vh - 4.7rem - 68px - 50px); min-height: 590px; }
  .email-mailbox-pane, .email-task-pane { display: none; height: 100%; }
  .email-mailbox-pane.is-mobile-active, .email-task-pane.is-mobile-active { display: block; }
  .email-mailbox-pane { padding: .45rem; }
  .mail-body { grid-template-columns: 1fr; }
  .mail-folders { display: none; }
  .opened-message article { padding: 1rem .8rem 2rem; }
  .email-copy { padding-left: 0; }
  .sender-card, .reply-draft { margin-left: 0; }
  .sender-line time { display: none; }
  .task-scroll { padding: 1rem 1rem 1.5rem; }
}

@media (max-width: 430px) {
  .email-lab-top strong { font-size: .87rem; }
  .email-lab-top a { font-size: .68rem; }
  .mail-head { gap: .7rem; }
  .mail-head label { min-width: 0; }
  .message-row { grid-template-columns: 34px minmax(0,1fr); padding: .75rem; }
  .message-row time { display: none; }
  .sender-line { grid-template-columns: 36px 1fr; }
}

body.ifd-email-lab-active { background: #eef2f5; overflow: hidden; }
body.ifd-email-lab-active .md-header,
body.ifd-email-lab-active .md-tabs,
body.ifd-email-lab-active .md-sidebar,
body.ifd-email-lab-active .md-footer,
body.ifd-email-lab-active .ifd-modebar { display: none !important; }
body.ifd-email-lab-active .md-main,
body.ifd-email-lab-active .md-main__inner,
body.ifd-email-lab-active .md-content,
body.ifd-email-lab-active .md-content__inner { height: 100vh; margin: 0; max-width: none; padding: 0; }
body.ifd-email-lab-active .md-content__inner::before,
body.ifd-email-lab-active .md-content__inner > h1,
body.ifd-email-lab-active .md-content__inner > .headerlink { display: none; }
body.ifd-email-lab-active #ifd-email-lab {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  inset: 0;
  left: 0;
  margin: 0;
  min-height: 0;
  overflow: hidden;
  position: fixed;
  width: 100vw;
  z-index: 40;
}
body.ifd-email-lab-active .email-lab-top,
body.ifd-email-lab-active .email-mobile-switch { flex: 0 0 auto; }
body.ifd-email-lab-active .email-workspace { flex: 1; height: auto !important; min-height: 0; overflow: hidden; }
