:root {
  color-scheme: light;
  --ink: #14213d;
  --muted: #667085;
  --line: #dfe5ee;
  --line-strong: #cbd5e1;
  --panel: #ffffff;
  --canvas: #f3f6fa;
  --navy: #0e2d52;
  --navy-2: #174c7c;
  --aqua: #2ab7a9;
  --aqua-soft: #dff8f4;
  --amber: #f4b942;
  --danger: #b42318;
  --danger-bg: #fff0ee;
  --shadow: 0 20px 55px rgba(20, 33, 61, 0.10);
  font-family: "DM Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--canvas); }
body { margin: 0; color: var(--ink); background: var(--canvas); min-height: 100vh; }
button, textarea, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
.hidden { display: none !important; }

.app-shell { min-height: 100vh; }
.topbar {
  height: 82px;
  padding: 0 clamp(20px, 4vw, 64px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255,255,255,.94);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(14px);
}
.brand { color: var(--ink); text-decoration: none; display: flex; gap: 12px; align-items: center; }
.brand strong { font: 800 18px/1.2 "Manrope", sans-serif; display: block; letter-spacing: -.02em; }
.brand small { display: block; color: var(--muted); margin-top: 2px; font-size: 12px; }
.brand-mark {
  width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center;
  background: var(--navy); box-shadow: inset 0 0 0 1px rgba(255,255,255,.15);
}
.brand-mark.large { width: 52px; height: 52px; margin: 0 auto 16px; }
.brand-mark svg { width: 26px; fill: none; stroke: white; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.login-button {
  min-height: 42px; padding: 0 14px; border: 1px solid var(--line); border-radius: 12px;
  background: white; color: var(--navy); display: inline-flex; align-items: center; gap: 8px;
  text-decoration: none; font-size: 13px; font-weight: 700;
}
.login-button:hover { border-color: var(--aqua); box-shadow: 0 8px 20px rgba(20,33,61,.08); }
.login-button { cursor: pointer; }
.login-button span { width: 9px; height: 9px; border-radius: 50%; background: #f4b942; box-shadow: 0 0 0 4px rgba(244,185,66,.16); }
.icon-button {
  width: 42px; height: 42px; padding: 0; border: 1px solid var(--line); background: white;
  color: var(--navy); border-radius: 12px; display: grid; place-items: center; cursor: pointer;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.icon-button:hover { border-color: var(--line-strong); transform: translateY(-1px); box-shadow: 0 8px 20px rgba(20,33,61,.08); }
.icon-button svg { width: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

main { width: min(1160px, calc(100% - 40px)); margin: 0 auto; padding: 56px 0 90px; }
.workspace, .results { animation: rise .45s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.intro-row { display: flex; justify-content: space-between; gap: 32px; align-items: flex-end; margin-bottom: 28px; }
.eyebrow { margin: 0 0 8px; text-transform: uppercase; color: var(--navy-2); letter-spacing: .14em; font-size: 12px; font-weight: 700; }
h1 { max-width: 790px; margin: 0; font: 800 clamp(32px, 4.3vw, 54px)/1.08 "Manrope", sans-serif; letter-spacing: -.045em; }
.intro-copy { max-width: 760px; margin: 16px 0 0; color: var(--muted); font-size: 17px; line-height: 1.65; }
.privacy-note { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; font-size: 13px; color: #186e64; background: var(--aqua-soft); border: 1px solid #bdece6; border-radius: 999px; padding: 9px 13px; }
.privacy-note svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

.link-panel { background: var(--panel); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); padding: 24px; }
.field-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.field-heading label { font: 700 15px/1 "Manrope", sans-serif; }
.field-heading span { color: var(--muted); font-size: 13px; }
.textarea-wrap { position: relative; }
.line-accent { position: absolute; top: 14px; left: 0; bottom: 14px; width: 3px; border-radius: 3px; background: linear-gradient(var(--aqua), var(--navy-2)); z-index: 1; }
textarea {
  display: block; width: 100%; min-height: 178px; resize: vertical; border: 1px solid var(--line-strong);
  border-radius: 14px; padding: 18px 18px 18px 23px; background: #fbfcfe; color: var(--ink);
  font: 500 15px/1.72 "DM Sans", sans-serif; outline: none; transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}
textarea::placeholder { color: #98a2b3; }
textarea:focus { border-color: var(--aqua); background: white; box-shadow: 0 0 0 4px rgba(42,183,169,.13); }
.form-footer { display: flex; align-items: center; justify-content: space-between; gap: 22px; margin-top: 18px; }
.form-footer p { max-width: 680px; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.primary-button, .secondary-button {
  min-height: 48px; border-radius: 13px; display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: 0 19px; font-weight: 700; text-decoration: none; border: 0; cursor: pointer; white-space: nowrap;
  transition: transform .16s ease, box-shadow .16s ease, opacity .16s ease;
}
.primary-button { color: white; background: linear-gradient(135deg, var(--navy), var(--navy-2)); box-shadow: 0 10px 22px rgba(14,45,82,.22); }
.primary-button:hover { transform: translateY(-1px); box-shadow: 0 14px 28px rgba(14,45,82,.26); }
.primary-button:disabled { cursor: wait; opacity: .68; transform: none; }
.primary-button svg, .secondary-button svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.primary-button svg path:first-child { fill: rgba(255,255,255,.08); }
.primary-button.full { width: 100%; margin-top: 8px; }

.results { margin-top: 34px; }
.result-summary { background: var(--navy); color: white; border-radius: 20px 20px 0 0; padding: 22px 24px; display: flex; justify-content: space-between; gap: 20px; align-items: center; }
.result-title-block { display: flex; gap: 14px; align-items: center; }
.result-title-block .eyebrow { color: #89ddd4; margin-bottom: 4px; }
.result-title-block h2 { margin: 0; font: 700 20px/1.3 "Manrope", sans-serif; }
.result-title-block p:last-child { margin: 4px 0 0; color: #c9d6e6; font-size: 13px; }
.status-orb { width: 42px; height: 42px; border-radius: 50%; background: rgba(255,255,255,.1); display: grid; place-items: center; }
.status-orb span { width: 10px; height: 10px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 7px rgba(244,185,66,.13); animation: pulse 1.6s infinite; }
.status-orb.complete span { background: #55d6be; box-shadow: 0 0 0 7px rgba(85,214,190,.13); animation: none; }
.status-orb.failed span { background: #ff7c72; box-shadow: 0 0 0 7px rgba(255,124,114,.13); animation: none; }
@keyframes pulse { 50% { box-shadow: 0 0 0 11px rgba(244,185,66,0); } }
.secondary-button { min-height: 44px; color: var(--navy); background: white; }
.secondary-button:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(0,0,0,.14); }
.secondary-button.disabled { opacity: .5; pointer-events: none; }
.metric-grid { display: grid; grid-template-columns: repeat(3, 1fr); background: white; border: 1px solid var(--line); border-top: 0; }
.metric-grid article { min-height: 92px; padding: 19px 24px; display: flex; flex-direction: column; justify-content: center; border-right: 1px solid var(--line); }
.metric-grid article:last-child { border-right: 0; }
.metric-grid span { color: var(--muted); font-size: 13px; }
.metric-grid strong { margin-top: 5px; font: 800 25px/1 "Manrope", sans-serif; color: var(--navy); }
.recording-errors { margin: 16px 0; padding: 15px 17px; border: 1px solid #fecdca; background: var(--danger-bg); border-radius: 13px; color: var(--danger); font-size: 14px; line-height: 1.5; }
.recording-errors strong { display: block; margin-bottom: 4px; }
.recording-errors ul { margin: 6px 0 0; padding-left: 20px; }

.tab-shell { background: white; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 20px 20px; overflow: hidden; }
.tabs { min-height: 66px; padding: 0 24px; display: flex; gap: 28px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab { position: relative; border: 0; background: transparent; color: var(--muted); font-weight: 700; padding: 0; cursor: pointer; white-space: nowrap; }
.tab.active { color: var(--navy); }
.tab.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--aqua); }
.tab span { min-width: 24px; display: inline-grid; place-items: center; margin-left: 6px; padding: 3px 7px; border-radius: 999px; background: #eef2f7; color: var(--navy); font-size: 12px; }
.tab-panel { padding: 24px; min-height: 190px; }
.question-list, .common-list { display: grid; gap: 12px; }
.recording-group { border: 1px solid var(--line); border-radius: 15px; overflow: hidden; }
.recording-group-head { padding: 14px 17px; background: #f8fafc; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.recording-group-head strong { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recording-group-head a { color: var(--navy-2); font-size: 12px; text-decoration: none; }
.recording-group-head span { color: var(--muted); font-size: 12px; white-space: nowrap; }
.question-row { display: grid; grid-template-columns: 48px minmax(0,1fr) auto; gap: 14px; align-items: start; padding: 17px; border-bottom: 1px solid #edf1f5; }
.question-row:last-child { border-bottom: 0; }
.question-number { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--aqua-soft); color: #137268; font: 800 13px/1 "Manrope", sans-serif; }
.question-copy p { margin: 0; font-size: 16px; line-height: 1.5; font-weight: 500; }
.question-meta { display: flex; gap: 8px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.chip { padding: 4px 8px; border-radius: 999px; background: #f2f4f7; color: var(--muted); font-size: 12px; }
.chip-repeat { background: #eef3fb; color: var(--navy-2); }
.question-flags { display: flex; gap: 7px; align-items: center; flex-wrap: wrap; margin: 0 0 8px; }
.flag { padding: 4px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; letter-spacing: .01em; border: 1px solid transparent; white-space: nowrap; }
.flag-yes { background: #e6f6ee; color: #0e7a4b; border-color: #bfe8d2; }
.flag-no { background: #fdf3e2; color: #96590d; border-color: #f2ddb6; }
.flag-correct { background: #e9f1fd; color: #1b5cb1; border-color: #cdddf6; }
.flag-zero { background: #f2f4f7; color: var(--muted); border-color: #e2e7ee; }
.common-card .question-flags { margin-bottom: 9px; }
.timestamp { color: var(--navy-2); font: 700 12px/1.4 "DM Sans", sans-serif; padding-top: 5px; }
.common-card { border: 1px solid var(--line); border-radius: 15px; padding: 18px; display: flex; justify-content: space-between; align-items: center; gap: 18px; }
.common-card h3 { margin: 0; font: 700 16px/1.5 "Manrope", sans-serif; }
.common-card p { margin: 7px 0 0; color: var(--muted); font-size: 13px; }
.frequency { min-width: 76px; height: 58px; border-radius: 13px; display: flex; flex-direction: column; align-items: center; justify-content: center; background: var(--navy); color: white; }
.frequency strong { font: 800 20px/1 "Manrope", sans-serif; }
.frequency span { margin-top: 4px; color: #c9d6e6; font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.empty-state { min-height: 142px; border: 1px dashed var(--line-strong); border-radius: 15px; display: grid; place-items: center; text-align: center; padding: 24px; color: var(--muted); }
.empty-state strong { display: block; color: var(--ink); margin-bottom: 5px; font-size: 15px; }
.loading-list { display: grid; gap: 11px; }
.skeleton { height: 72px; border-radius: 13px; background: linear-gradient(90deg, #eef2f6 25%, #f7f9fb 50%, #eef2f6 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

.history-drawer { position: fixed; z-index: 50; top: 0; right: 0; width: min(430px, 92vw); height: 100vh; background: white; box-shadow: -20px 0 60px rgba(20,33,61,.18); transform: translateX(105%); transition: transform .25s ease; padding: 26px; overflow-y: auto; }
.history-drawer.open { transform: translateX(0); }
.drawer-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(14,31,53,.34); opacity: 0; pointer-events: none; transition: opacity .25s ease; }
.drawer-backdrop.open { opacity: 1; pointer-events: auto; }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 22px; }
.drawer-head h2 { margin: 0; font: 800 24px/1.2 "Manrope", sans-serif; }
.history-list { display: grid; gap: 10px; }
.history-item { width: 100%; text-align: left; border: 1px solid var(--line); background: white; border-radius: 13px; padding: 14px; cursor: pointer; color: var(--ink); }
.history-item:hover { border-color: var(--aqua); }
.history-item-top { display: flex; justify-content: space-between; gap: 12px; }
.history-item strong { font-size: 14px; }
.history-item time, .history-item p { color: var(--muted); font-size: 12px; }
.history-item p { margin: 8px 0 0; }
.status-pill { padding: 3px 7px; border-radius: 999px; background: #eef2f7; font-size: 10px; text-transform: uppercase; letter-spacing: .06em; }

.microsoft-dialog { width: min(1320px, calc(100% - 32px)); max-height: calc(100dvh - 32px); padding: 22px; border: 1px solid var(--line); border-radius: 20px; color: var(--ink); background: white; box-shadow: var(--shadow); overflow: auto; }
.microsoft-dialog::backdrop { background: rgba(14,31,53,.72); }
.microsoft-dialog-head, .microsoft-toolbar, .microsoft-dialog-footer { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.microsoft-dialog-head h2 { margin: 0; font: 800 24px/1.2 "Manrope", sans-serif; }
.microsoft-dialog .secondary-button { border: 1px solid var(--line); }
.microsoft-help { margin: 14px 0; color: var(--muted); font-size: 14px; line-height: 1.55; }
.microsoft-toolbar { margin-bottom: 12px; flex-wrap: wrap; }
.microsoft-toolbar > p { margin: 0; font-size: 13px; color: var(--navy-2); }
.microsoft-browser-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.microsoft-browser-actions .secondary-button { min-height: 38px; padding: 0 12px; font-size: 13px; }
.microsoft-browser-frame { display: block; width: 100%; height: clamp(280px, 56dvh, 700px); border: 1px solid var(--line-strong); border-radius: 12px; background: #eef2f7; }
.microsoft-dialog-footer { margin-top: 16px; }
#microsoftSessionStatus { margin: 0; font-size: 14px; font-weight: 700; }
.microsoft-session-note { margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.microsoft-dialog .field-error { font-size: 13px; line-height: 1.5; }

.password-dialog { position: fixed; inset: 0; z-index: 80; background: rgba(14,31,53,.7); display: grid; place-items: center; padding: 20px; backdrop-filter: blur(7px); }
.password-card { width: min(410px, 100%); background: white; padding: 30px; border-radius: 20px; box-shadow: 0 26px 80px rgba(0,0,0,.24); text-align: center; }
.password-card h2 { margin: 0; font: 800 24px/1.2 "Manrope", sans-serif; }
.password-card > p { color: var(--muted); font-size: 14px; line-height: 1.55; }
.password-card label { display: block; text-align: left; font-weight: 700; font-size: 13px; margin: 18px 0 7px; }
.password-card input { width: 100%; min-height: 48px; border: 1px solid var(--line-strong); border-radius: 12px; padding: 0 14px; outline: none; }
.password-card input:focus { border-color: var(--aqua); box-shadow: 0 0 0 4px rgba(42,183,169,.13); }
.field-error { color: var(--danger) !important; text-align: left; margin: 7px 0 !important; }
.toast { position: fixed; left: 50%; bottom: 28px; z-index: 90; transform: translateX(-50%); max-width: min(520px, calc(100% - 32px)); padding: 12px 16px; background: var(--ink); color: white; border-radius: 11px; box-shadow: var(--shadow); font-size: 14px; animation: rise .2s ease; }

@media (max-width: 760px) {
  .topbar { height: 70px; padding: 0 18px; }
  .login-button { padding: 0 10px; font-size: 12px; }
  main { width: min(100% - 28px, 1160px); padding-top: 34px; }
  .intro-row { align-items: flex-start; flex-direction: column; gap: 18px; }
  .privacy-note { align-self: flex-start; }
  h1 { font-size: clamp(31px, 10vw, 42px); }
  .intro-copy { font-size: 16px; }
  .link-panel { padding: 17px; border-radius: 18px; }
  .form-footer { align-items: stretch; flex-direction: column; }
  .primary-button { width: 100%; }
  .result-summary { align-items: stretch; flex-direction: column; }
  .secondary-button { width: 100%; }
  .metric-grid { grid-template-columns: 1fr; }
  .metric-grid article { min-height: 72px; border-right: 0; border-bottom: 1px solid var(--line); }
  .metric-grid article:last-child { border-bottom: 0; }
  .tabs { padding: 0 17px; gap: 22px; }
  .tab-panel { padding: 17px; }
  .question-row { grid-template-columns: 38px minmax(0,1fr); }
  .timestamp { grid-column: 2; padding: 0; }
  .common-card { align-items: flex-start; }
  .microsoft-dialog { width: calc(100% - 16px); max-height: calc(100dvh - 16px); padding: 14px; border-radius: 14px; }
  .microsoft-dialog-head .secondary-button { width: auto; }
  .microsoft-browser-actions { width: 100%; }
  .microsoft-browser-actions .secondary-button { flex: 1; width: auto; }
  .microsoft-dialog-footer { align-items: stretch; flex-direction: column; }
  .microsoft-browser-frame { height: 48dvh; min-height: 260px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
