:root {
  --ms-blue: #0067B8;
  --ms-blue-dark: #005A9E;
  --ms-dark: #242424;
  --ms-grey: #605E5C;
  --ms-border: #E1DFDD;
  --ms-bg: #F5F5F5;
  --ms-card: #FFFFFF;
  --ms-accent: #FFB900;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
  --radius: 6px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
  color: var(--ms-dark);
  background: var(--ms-bg);
  font-size: 14px;
  line-height: 1.5;
}

.muted { color: var(--ms-grey); }

.topbar {
  position: sticky; top: 0; z-index: 50;
  background: #fff;
  border-bottom: 1px solid var(--ms-border);
  box-shadow: var(--shadow-sm);
}
.topbar-inner {
  max-width: 1400px; margin: 0 auto;
  padding: 12px 24px;
  display: flex; align-items: center; justify-content: space-between;
}
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.help-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; font-size: 12px; font-weight: 600;
}
.help-toggle .help-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 8px;
  background: var(--ms-grey); color: #fff; font-size: 11px; font-weight: 700;
}
.help-toggle[aria-pressed="true"] {
  background: var(--ms-blue); color: #fff; border-color: var(--ms-blue);
}
.help-toggle[aria-pressed="true"] .help-icon { background: #fff; color: var(--ms-blue); }
.help-toggle[aria-pressed="true"] .help-label { color: #fff; }

.intro-strip {
  max-width: 1400px; margin: 0 auto;
  padding: 10px 24px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  background: #EAF2FB; color: var(--ms-dark); font-size: 13px;
  border-bottom: 1px solid #C7DBF0;
}
.intro-strip p { margin: 0; line-height: 1.5; }
.intro-strip strong { color: var(--ms-blue); }
.intro-strip code {
  background: #fff; padding: 1px 5px; border-radius: 3px; font-size: 12px;
  border: 1px solid #C7DBF0;
}
.intro-strip .icon-btn {
  flex: 0 0 auto; background: transparent; border: none; cursor: pointer;
  font-size: 18px; line-height: 1; color: var(--ms-grey);
}
.intro-strip[hidden] { display: none; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 14px; }
.brand svg { display: block; }
.who { font-size: 12px; color: var(--ms-grey); }
.who strong { color: var(--ms-dark); font-weight: 600; }

/* Catalog divider between Quick picks and the topic accordion */
.catalog-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 22px 0 16px 0;
  font-size: 12px; font-weight: 700; color: var(--ms-grey);
  text-transform: uppercase; letter-spacing: 0.6px;
}
.catalog-divider::before,
.catalog-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--ms-border);
}

/* Help tip badges (hidden by default; revealed when body has .help-mode) */
.help-tip {
  display: none;
  position: relative;
  width: 16px; height: 16px; border-radius: 8px;
  background: #FFE39A; color: #875100; font-size: 11px; font-weight: 700;
  text-align: center; line-height: 16px; cursor: help;
  vertical-align: middle;
  margin-left: 6px;
}
.help-tip.block { display: none; margin: 6px 0 0 0; }
body.help-mode .help-tip { display: inline-flex; align-items: center; justify-content: center; }
body.help-mode .help-tip.block { display: inline-flex; }
.help-tip::before { content: '?'; }
.help-tip:hover::after,
.help-tip:focus::after,
.help-tip:active::after {
  content: attr(data-tip);
  position: absolute; left: 22px; top: 50%; transform: translateY(-50%);
  background: var(--ms-dark); color: #fff;
  padding: 8px 10px; border-radius: 4px; font-size: 12px; font-weight: 400;
  line-height: 1.4; width: 240px; white-space: normal; text-align: left;
  letter-spacing: 0; text-transform: none;
  box-shadow: var(--shadow-md);
  z-index: 30;
}

.layout {
  max-width: 1400px; margin: 0 auto;
  display: grid; grid-template-columns: 1fr 380px; gap: 24px;
  padding: 24px;
}
@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .composer { order: -1; }
}

.catalog-head { margin-bottom: 16px; }
.catalog-head h1 { font-size: 22px; margin: 0 0 12px 0; font-weight: 600; }
.catalog-controls { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.catalog-controls input[type="search"] {
  flex: 1; min-width: 240px;
  padding: 9px 12px; font-size: 14px;
  border: 1px solid var(--ms-border); border-radius: var(--radius); background: #fff;
}
.catalog-controls input[type="search"]:focus { outline: 2px solid var(--ms-blue); outline-offset: 1px; border-color: var(--ms-blue); }

.quick-picks {
  margin: 0 0 18px 0;
  border: 1px solid var(--ms-border); border-radius: var(--radius); background: #fff;
}
.quick-picks-head {
  width: 100%; box-sizing: border-box;
  display: flex; align-items: center; justify-content: space-between;
  background: #fff; border: none; cursor: pointer;
  padding: 12px 14px; font-family: inherit; text-align: left;
}
.quick-picks-head:hover { background: #fafafa; }
.quick-picks-head h2 { font-size: 14px; font-weight: 600; margin: 0; color: var(--ms-dark); display: flex; align-items: center; gap: 8px; }
.quick-picks-head h2::before {
  content: ''; display: inline-block; width: 0; height: 0;
  border-left: 5px solid var(--ms-blue);
  border-top: 4px solid transparent; border-bottom: 4px solid transparent;
  transition: transform 0.15s ease;
}
.quick-picks.is-open .quick-picks-head h2::before { transform: rotate(90deg); }
.quick-picks-body { padding: 4px 14px 14px 14px; border-top: 1px solid var(--ms-border); }
.quick-picks-intro { font-size: 12px; color: var(--ms-grey); margin: 10px 0 14px 0; }
.quick-picks-grid { display: grid; gap: 10px; }
.bundle-row {
  display: grid; grid-template-columns: minmax(140px, 1fr) auto auto; gap: 10px; align-items: center;
}
.bundle-row .bundle-theme { font-size: 13px; font-weight: 600; color: var(--ms-dark); }
.bundle-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px; border: 1px solid var(--ms-border); border-radius: 14px;
  background: #fff; cursor: pointer; font-family: inherit; font-size: 12px; color: var(--ms-dark);
  transition: background 0.12s, border-color 0.12s;
  white-space: nowrap;
}
.bundle-chip:hover { background: #F3F9FD; border-color: var(--ms-blue); }
.bundle-chip[data-level="beginner-friendly"] .dot { background: #2E8B57; }
.bundle-chip[data-level="advanced"] .dot { background: #B73B43; }
.bundle-chip .dot { display: inline-block; width: 8px; height: 8px; border-radius: 4px; }
.bundle-chip .count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  background: var(--ms-bg); color: var(--ms-grey);
  border-radius: 9px; font-size: 10px; font-weight: 700;
}
.bundle-chip.is-disabled { opacity: 0.45; cursor: not-allowed; }
.bundle-flash {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--ms-dark); color: #fff;
  padding: 10px 14px; border-radius: 6px; font-size: 13px;
  box-shadow: var(--shadow-md); z-index: 200;
  opacity: 0; transform: translateY(8px); transition: opacity 0.2s, transform 0.2s;
}
.bundle-flash.is-visible { opacity: 1; transform: translateY(0); }

.topic { margin-bottom: 14px; }
.topic-head {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; box-sizing: border-box;
  border: 1px solid var(--ms-border); border-radius: var(--radius);
  padding: 10px 14px; margin: 0; background: #fff; cursor: pointer;
  user-select: none; font-family: inherit; text-align: left;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.topic-head:hover { background: #fafafa; border-color: #C7E0F4; }
.topic-head h2 { font-size: 14px; font-weight: 600; margin: 0; color: var(--ms-dark); display: flex; align-items: center; gap: 10px; }
.topic-head h2::before {
  content: ''; display: inline-block; width: 0; height: 0;
  border-left: 5px solid var(--ms-blue);
  border-top: 4px solid transparent; border-bottom: 4px solid transparent;
  transition: transform 0.15s ease;
}
.topic.is-open .topic-head h2::before { transform: rotate(90deg); }
.topic-head .topic-count { font-size: 12px; color: var(--ms-grey); }
.topic-body { display: none; padding: 12px 0 4px 0; }
.topic.is-open .topic-body { display: block; }
.topic-pick-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  background: var(--ms-blue); color: #fff; border-radius: 9px;
  font-size: 10px; font-weight: 700; margin-left: 8px;
}
.topic-pick-badge[data-count="0"] { display: none; }

.grid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.card {
  background: var(--ms-card);
  border: 1px solid var(--ms-border); border-radius: var(--radius);
  padding: 14px 14px 12px 14px;
  display: flex; flex-direction: column;
  transition: box-shadow 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}
.card:hover { box-shadow: var(--shadow-md); border-color: #C7E0F4; }
.card.selected { border-color: var(--ms-blue); box-shadow: 0 0 0 1px var(--ms-blue) inset; background: #F3F9FD; }

.card header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card .code {
  font-size: 10px; letter-spacing: 0.6px; text-transform: uppercase;
  color: #fff; background: var(--ms-blue); padding: 2px 7px; border-radius: 10px; font-weight: 600;
}
.card .type { font-size: 11px; }
.card h3.title { font-size: 15px; line-height: 1.35; margin: 8px 0 4px 0; font-weight: 600; }
.card .speakers { font-size: 12px; margin: 0 0 8px 0; }
.card .desc {
  font-size: 13px; line-height: 1.5; margin: 0 0 12px 0; color: #444;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}
.card footer { margin-top: auto; display: flex; align-items: center; gap: 10px; justify-content: space-between; }
.card .watch-link { font-size: 12px; color: var(--ms-blue); text-decoration: none; }
.card .watch-link:hover { text-decoration: underline; }

button.primary, button.secondary, button.ghost {
  font-family: inherit; font-size: 13px; font-weight: 600;
  padding: 8px 14px; border-radius: 4px; cursor: pointer; border: 1px solid transparent;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
button.primary { background: var(--ms-blue); color: #fff; }
button.primary:hover { background: var(--ms-blue-dark); }
button.secondary { background: #fff; color: var(--ms-blue); border-color: var(--ms-blue); }
button.secondary:hover { background: #F3F9FD; }
button.ghost { background: transparent; color: var(--ms-grey); border-color: var(--ms-border); }
button.ghost:hover { background: #fafafa; color: var(--ms-dark); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.card .pick-btn { padding: 6px 12px; font-size: 12px; }
.card.selected .pick-btn { background: #fff; color: var(--ms-blue); border-color: var(--ms-blue); }

.composer {
  position: relative;
}
.composer-inner {
  position: sticky; top: 76px;
  max-height: calc(100vh - 100px); overflow: auto;
  display: flex; flex-direction: column; gap: 14px;
}
.panel {
  background: #fff; border: 1px solid var(--ms-border); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow-sm);
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.panel-head h2 {
  font-size: 15px; margin: 0; font-weight: 600;
  display: flex; align-items: center; gap: 8px;
}
.panel-help {
  font-size: 12px; color: var(--ms-grey);
  margin: -2px 0 12px 0; line-height: 1.45;
}
.selection-panel { border-top: 3px solid var(--ms-blue); }
.email-panel { border-top: 3px solid #FFB900; }
button.ghost.small { padding: 4px 10px; font-size: 11px; }

.composer h2 { font-size: 15px; margin: 0 0 10px 0; display: flex; align-items: center; gap: 8px; font-weight: 600; }
.count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 22px; padding: 0 6px;
  background: var(--ms-blue); color: #fff; border-radius: 11px; font-size: 11px; font-weight: 700;
}

.picks { list-style: none; padding: 0; margin: 0 0 16px 0; }
.picks:empty::after {
  content: 'No sessions picked yet. Click "Add" on a card to start.';
  display: block; padding: 14px; font-size: 12px; color: var(--ms-grey);
  background: #fafafa; border: 1px dashed var(--ms-border); border-radius: 4px; text-align: center;
}
.picks li {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  border: 1px solid var(--ms-border); border-radius: 4px; margin-bottom: 6px; background: #fff;
}
.picks .pick-code { font-size: 10px; letter-spacing: 0.4px; font-weight: 700; color: var(--ms-blue); min-width: 50px; }
.picks .pick-title { flex: 1; font-size: 12px; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picks .pick-actions { display: flex; gap: 4px; }
.picks .icon-btn {
  background: transparent; border: 1px solid var(--ms-border); border-radius: 3px;
  width: 22px; height: 22px; font-size: 13px; line-height: 1; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; color: var(--ms-grey);
  padding: 0;
}
.picks .icon-btn:hover { background: #fafafa; color: var(--ms-dark); }

fieldset { border: none; padding: 0; margin: 14px 0 14px 0; }
fieldset legend { font-size: 12px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--ms-grey); font-weight: 600; padding: 0 0 8px 0; }
label { display: block; font-size: 12px; color: var(--ms-grey); margin-bottom: 10px; font-weight: 600; }
label input, label textarea {
  display: block; width: 100%; margin-top: 4px;
  padding: 8px 10px; font-size: 13px; font-family: inherit; color: var(--ms-dark);
  border: 1px solid var(--ms-border); border-radius: 4px; background: #fff;
}
label input:focus, label textarea:focus { outline: 2px solid var(--ms-blue); outline-offset: 1px; border-color: var(--ms-blue); }
label textarea { resize: vertical; min-height: 80px; line-height: 1.5; }

.composer-actions { display: flex; gap: 8px; align-items: center; margin-top: 4px; }
.composer-actions .primary { flex: 1; padding: 10px 14px; font-size: 13px; }

.modal[hidden] { display: none; }
.modal {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.modal-backdrop {
  position: absolute; inset: 0; background: rgba(0, 0, 0, 0.45);
}
.modal-card {
  position: relative; background: #fff; border-radius: 8px;
  width: 100%; max-width: 760px; max-height: 90vh;
  display: flex; flex-direction: column; box-shadow: var(--shadow-md);
}
.modal-head {
  padding: 14px 18px; border-bottom: 1px solid var(--ms-border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-head h3 { margin: 0; font-size: 16px; font-weight: 600; }
.modal-head .icon-btn {
  background: transparent; border: none; font-size: 22px; line-height: 1; cursor: pointer; color: var(--ms-grey);
}
.modal-body { padding: 14px 18px; overflow: auto; flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; }
.preview-meta { font-size: 13px; }
.modal-body iframe {
  width: 100%; flex: 1; min-height: 420px;
  border: 1px solid var(--ms-border); border-radius: 4px; background: #fff;
}
.modal-actions {
  padding: 12px 18px; border-top: 1px solid var(--ms-border);
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
}
.modal-actions .ghost-link { font-size: 13px; color: var(--ms-blue); text-decoration: none; padding: 8px 6px; }
.modal-actions .ghost-link:hover { text-decoration: underline; }
.status { font-size: 12px; color: var(--ms-grey); margin-left: auto; }

.template-choices { display: grid; gap: 6px; margin-top: 4px; }
.template-choice {
  display: block; padding: 10px 12px; cursor: pointer;
  border: 1px solid var(--ms-border); border-radius: 4px; background: #fff;
  font-weight: 400; color: var(--ms-dark);
}
.template-choice input { position: absolute; opacity: 0; pointer-events: none; }
.template-choice strong { display: block; font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.template-choice span { display: block; font-size: 12px; color: var(--ms-grey); line-height: 1.4; }
.template-choice.is-selected { border-color: var(--ms-blue); background: #F3F9FD; box-shadow: 0 0 0 1px var(--ms-blue) inset; }

.loading { padding: 40px 20px; text-align: center; color: var(--ms-grey); font-size: 14px; }
.error { padding: 14px 18px; background: #FDE7E9; border: 1px solid #F1707B; border-radius: 4px; color: #6E0811; margin-bottom: 14px; }
