:root {
  color-scheme: light;
  --navy: #18345f;
  --blue: #357cd4;
  --green: #368d58;
  --green-dark: #22683d;
  --red: #b84742;
  --amber: #bd8100;
  --ink: #17243a;
  --muted: #6e7787;
  --bg: #f4f7fb;
  --card: #ffffff;
  --soft: #edf2f8;
  --line: #d6dfeb;
  --shadow: 0 16px 42px rgba(24, 52, 95, .10);
  --base-font: 16px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #eef4ff;
  --muted: #a9b5c7;
  --bg: #0f1724;
  --card: #172236;
  --soft: #202d43;
  --line: #35445b;
  --shadow: 0 18px 50px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { font-size: var(--base-font); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 0%, rgba(53, 124, 212, .10), transparent 32rem),
    var(--bg);
  font-family: "Noto Sans Thai", "Leelawadee UI", system-ui, sans-serif;
}
button, input, select { font: inherit; }
button { touch-action: manipulation; }

.record-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--card) 94%, transparent);
  backdrop-filter: blur(16px);
}
.record-topbar-main {
  width: min(1600px, calc(100% - 32px));
  margin: auto;
  min-height: 82px;
  display: flex;
  align-items: center;
  gap: 24px;
}
.record-brand { min-width: 270px; }
.record-brand h1 { margin: 0; font-size: 1.45rem; line-height: 1.1; }
.record-brand p { margin: 4px 0 0; max-width: 500px; color: var(--muted); font-size: .78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.eyebrow { color: var(--blue); font-weight: 800; font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; }
.app-nav { display: flex; align-items: center; justify-content: center; gap: 6px; flex: 1; flex-wrap: wrap; }
.nav-pill {
  color: var(--muted);
  text-decoration: none;
  border-radius: 999px;
  padding: 9px 14px;
  font-weight: 700;
  font-size: .83rem;
  transition: .18s ease;
}
.nav-pill:hover { color: var(--ink); background: var(--soft); }
.nav-pill.active { color: #fff; background: var(--navy); }
.signer-active #editorNavPill, .signer-active #trimmerNavPill { display: none !important; }
.active-signer-badge { flex: 0 1 250px; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 5px 11px 5px 5px; border: 2px solid var(--green); border-radius: 16px; background: color-mix(in srgb, var(--green) 10%, var(--card)); }
.active-signer-badge img { width: 50px; height: 50px; flex: 0 0 auto; border-radius: 12px; object-fit: cover; background: var(--soft); }
.active-signer-badge span { min-width: 0; }
.active-signer-badge strong, .active-signer-badge small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.active-signer-badge strong { color: var(--ink); font-size: .9rem; }
.active-signer-badge small { margin-top: 2px; color: var(--green-dark); font-weight: 900; }
:root[data-theme="dark"] .active-signer-badge small { color: #9ddbb4; }
.utility-actions { display: flex; gap: 8px; align-items: center; }
.icon-button, .more-menu summary {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
  font-weight: 800;
  list-style: none;
}
.more-menu { position: relative; }
.more-menu summary::-webkit-details-marker { display: none; }
.more-popover {
  position: absolute;
  right: 0;
  top: 48px;
  width: 230px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  box-shadow: var(--shadow);
}
.more-popover button { width: 100%; min-height: 48px; border: 0; border-radius: 10px; text-align: left; padding: 0 12px; background: transparent; color: var(--ink); cursor: pointer; }
.more-popover button:hover { background: var(--soft); }

.portal-shell { width: min(1460px, calc(100% - 32px)); margin: 28px auto 70px; }
.screen {
  min-height: calc(100vh - 180px);
  padding: clamp(24px, 4vw, 52px);
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--card);
  box-shadow: var(--shadow);
}
.centered-screen { display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; }
.narrow { width: min(760px, 100%); margin: auto; }
.centered-screen h2 { margin: 16px 0 8px; font-size: clamp(2rem, 5vw, 3.2rem); color: var(--navy); }
:root[data-theme="dark"] .centered-screen h2 { color: #a9c9ff; }
.centered-screen > p { color: var(--muted); }
.lead { max-width: 720px; font-size: 1.15rem; line-height: 1.75; }
.hero-visual, .visual-icon {
  display: grid;
  place-items: center;
  width: 112px;
  height: 112px;
  border-radius: 32px;
  color: #fff;
  background: linear-gradient(145deg, var(--blue), var(--navy));
  box-shadow: 0 12px 28px rgba(53, 124, 212, .28);
  font-size: 3.5rem;
}
.visual-icon { width: 68px; height: 68px; border-radius: 20px; font-size: 2rem; flex: 0 0 auto; }
.hero-visual.person { background: linear-gradient(145deg, #7289aa, var(--navy)); }
.hero-visual.success { background: linear-gradient(145deg, #55ad76, var(--green-dark)); font-weight: 900; }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.step-chip { margin-top: 22px; padding: 7px 15px; border-radius: 999px; background: #e7f1ff; color: #235c9e; font-weight: 800; }
:root[data-theme="dark"] .step-chip { background: #233b5d; color: #b7d4ff; }
.promise-grid { width: min(520px, 100%); margin: 26px 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.promise-grid article { display: grid; gap: 3px; padding: 20px 14px; border: 1px solid var(--line); border-radius: 18px; background: var(--soft); }
.promise-grid article span { font-size: 2rem; }
.promise-grid article strong { font-size: 1.15rem; }
.promise-grid article small { color: var(--muted); }
.practice-steps { width: min(680px, 100%); margin: 24px 0 16px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.practice-steps div { display: grid; justify-items: center; gap: 8px; padding: 18px 12px; border: 1px solid var(--line); border-radius: 16px; background: var(--soft); font-weight: 800; }
.practice-steps strong { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--navy); color: #fff; font-size: 1.1rem; }
.practice-storage-note { margin: 0 0 20px; color: var(--muted); font-size: .9rem; }
.record-screen.practice-mode .progress-track span { background: #9a62d3; }
.record-screen.practice-mode .record-word-line > span { color: #7f43bd; }
:root[data-theme="dark"] .record-screen.practice-mode .record-word-line > span { color: #d1adf5; }
.primary-button {
  width: min(680px, 100%);
  min-height: 64px;
  margin-top: 24px;
  padding: 12px 22px;
  border: 0;
  border-radius: 15px;
  color: #fff;
  background: linear-gradient(180deg, #459c65, var(--green));
  box-shadow: 0 10px 22px rgba(54, 141, 88, .25);
  font-size: 1.28rem;
  font-weight: 900;
  cursor: pointer;
}
.primary-button:hover:not(:disabled) { transform: translateY(-1px); filter: brightness(1.04); }
.primary-button:disabled { opacity: .38; cursor: not-allowed; box-shadow: none; }
.text-button { border: 0; background: transparent; color: var(--muted); padding: 14px; cursor: pointer; }
.text-button:hover { color: var(--ink); text-decoration: underline; }
.secondary-button { min-height: 58px; padding: 11px 18px; border: 2px solid var(--navy); border-radius: 14px; color: var(--navy); background: var(--card); font-size: 1.05rem; font-weight: 900; cursor: pointer; }
.secondary-button:hover:not(:disabled) { background: var(--soft); transform: translateY(-1px); }
.secondary-button:disabled { opacity: .38; cursor: not-allowed; }
:root[data-theme="dark"] .secondary-button { border-color: #a9c9ff; color: #d9e7ff; }

.screen-head { display: flex; align-items: center; gap: 18px; margin-bottom: 28px; }
.screen-head h2 { margin: 0; color: var(--navy); font-size: clamp(1.8rem, 4vw, 2.6rem); }
:root[data-theme="dark"] .screen-head h2 { color: #a9c9ff; }
.screen-head p { margin: 5px 0 0; color: var(--muted); font-size: 1.05rem; }
.signer-list-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 28px; }
.signer-list-head .screen-head { margin-bottom: 0; }
.add-signer-button { flex: 0 0 auto; min-height: 58px; padding: 10px 24px; border: 0; border-radius: 14px; color: #fff; background: linear-gradient(180deg, #459c65, var(--green)); font-size: 1.15rem; font-weight: 900; cursor: pointer; box-shadow: 0 8px 18px rgba(47, 134, 79, .2); }
.add-signer-button:hover:not(:disabled) { filter: brightness(1.06); transform: translateY(-1px); }
.add-signer-button:disabled { opacity: .55; cursor: wait; }
.compact-workspace .record-topbar-main { min-height: 56px; }
.compact-workspace .record-brand p, .compact-workspace .eyebrow { display: none; }
.compact-workspace .portal-shell { margin-top: 8px; }
.compact-workspace .screen.camera-setup,
.compact-workspace .screen.record-screen,
.compact-workspace .screen.batch-review-screen { min-height: calc(100vh - 76px); }
.compact-camera-head { min-width: 0; gap: 9px; margin-bottom: 7px; white-space: nowrap; }
.compact-camera-head .visual-icon { width: 38px; height: 38px; border-radius: 11px; font-size: 1.15rem; }
.compact-camera-head > div { min-width: 0; display: flex; align-items: baseline; gap: 10px; }
.compact-camera-head h2 { flex: 0 0 auto; font-size: 1.4rem; line-height: 1; }
.compact-camera-head p { min-width: 0; margin: 0; overflow: hidden; text-overflow: ellipsis; font-size: .88rem; }
.signer-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.signer-card {
  min-height: 126px;
  padding: 18px;
  border: 2px solid #b8d3f2;
  border-radius: 18px;
  background: #edf6ff;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 14px;
  align-items: center;
}
:root[data-theme="dark"] .signer-card { background: #1a304d; border-color: #345a87; }
.signer-card:hover:not(:disabled) { border-color: var(--blue); transform: translateY(-2px); }
.signer-card.in-progress { border-color: #d4a43d; background: #fff8df; }
:root[data-theme="dark"] .signer-card.in-progress { background: #483b1d; }
.signer-card:disabled { opacity: .5; cursor: not-allowed; filter: grayscale(.4); }
.signer-card .person-icon { font-size: 2.2rem; }
.signer-card strong { display: block; font-size: 1.15rem; }
.signer-card small { display: block; margin-top: 6px; color: var(--muted); }
.signer-card .card-status { text-align: right; color: var(--blue); font-weight: 800; }
.signer-card .card-status-main { display: block; }
.signer-card .card-words { display: block; margin-top: 4px; color: var(--muted); font-size: .86rem; font-weight: 700; white-space: nowrap; }

.form-screen { max-width: 1100px; margin: auto; }
.form-card { display: grid; gap: 18px; }
.field { display: grid; gap: 7px; }
.field span, fieldset legend { font-weight: 800; }
.field input {
  width: 100%; min-height: 56px; border: 1.5px solid var(--line); border-radius: 13px;
  padding: 0 15px; color: var(--ink); background: var(--bg); font-size: 1.05rem;
}
fieldset { margin: 0; padding: 16px; border: 1px solid var(--line); border-radius: 16px; }
fieldset legend { padding: 0 7px; }
.choice-row { display: flex; flex-wrap: wrap; gap: 9px; }
.choice-row label { cursor: pointer; }
.choice-row input { position: absolute; opacity: 0; pointer-events: none; }
.choice-row span { display: grid; place-items: center; min-height: 52px; padding: 8px 16px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--bg); }
.choice-row input:checked + span { border-color: var(--green); color: var(--green-dark); background: #e5f5ea; box-shadow: inset 0 0 0 1px var(--green); }
:root[data-theme="dark"] .choice-row input:checked + span { color: #b8e9c9; background: #21402d; }
.ack-row { display: flex; gap: 14px; align-items: center; padding: 17px; border: 2px solid var(--line); border-radius: 16px; cursor: pointer; }
.ack-row input { width: 24px; height: 24px; accent-color: var(--green); }
.ack-row .ack-icon { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: var(--green); font-size: 1.4rem; }
.ack-row strong, .ack-row small { display: block; }
.ack-row small { color: var(--muted); margin-top: 4px; }
.form-card .primary-button { justify-self: center; }
.profile-photo-field legend small { color: var(--red); font-size: .78rem; }
.profile-photo-capture { display: flex; align-items: center; gap: 20px; }
.profile-photo-preview { flex: 0 0 auto; width: 144px; aspect-ratio: 4 / 5; display: grid; place-items: center; overflow: hidden; border: 2px dashed var(--line); border-radius: 16px; background: var(--bg); }
.profile-photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.profile-photo-preview span { font-size: 3rem; opacity: .55; }
.profile-photo-capture > div:last-child { display: grid; justify-items: start; gap: 9px; }
.profile-photo-capture input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.photo-button { min-height: 52px; display: inline-flex; align-items: center; padding: 9px 18px; border: 2px solid var(--navy); border-radius: 13px; color: var(--navy); background: var(--card); font-weight: 900; cursor: pointer; }
.profile-photo-capture p { margin: 0; color: var(--muted); font-size: .9rem; }
:root[data-theme="dark"] .photo-button { border-color: #a9c9ff; color: #d9e7ff; }

.consent-list { display: grid; gap: 12px; }
/* The acknowledgement cards fill the .form-screen column, so the button under them
   has to as well — .primary-button's min(680px, 100%) cap is meant for the centred
   screens and leaves this one short and left-hugging. */
#consentScreen .primary-button { width: 100%; }
.consent-list button {
  min-height: 76px; display: grid; grid-template-columns: 54px 1fr 44px; align-items: center; gap: 12px;
  border: 2px solid var(--line); border-radius: 16px; padding: 10px 16px; background: var(--card); color: var(--ink); text-align: left; cursor: pointer;
}
.consent-list button > span { font-size: 2rem; text-align: center; }
.consent-list button strong { font-size: 1.05rem; }
.consent-list button i { font-style: normal; font-size: 1.8rem; color: var(--muted); }
.consent-list button.done { border-color: var(--green); background: #e8f5ec; }
:root[data-theme="dark"] .consent-list button.done { background: #1d3e29; }
.consent-list button.done i { color: var(--green); }
.full-consent { margin: 18px 0 0; max-width: 680px; color: var(--muted); }
.full-consent p { text-align: left; line-height: 1.8; }
.receipt-card { width: 100%; margin-top: 18px; border: 1px solid var(--line); border-radius: 18px; padding: 22px; background: var(--soft); text-align: left; }
.receipt-card > span { display: block; color: var(--muted); }
.receipt-card > strong { display: block; margin: 5px 0 18px; color: var(--navy); font-size: 1.5rem; overflow-wrap: anywhere; }
.receipt-card dl { margin: 0; }
.receipt-card dl div { display: grid; grid-template-columns: 130px 1fr; gap: 10px; border-top: 1px solid var(--line); padding: 10px 0; }
.receipt-card dt { color: var(--muted); }
.receipt-card dd { margin: 0; font-weight: 700; }

/* Setup is now "copy the example on the left with your camera on the right",
   so the two panes are equal — there is nothing to validate beside them. */
.setup-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 820px) { .setup-grid { grid-template-columns: minmax(0, 1fr); } }
.setup-example-shell video { object-fit: cover; }
.shell-tag { position: absolute; left: 12px; top: 12px; padding: 5px 12px; border-radius: 999px;
  background: rgba(6, 10, 16, .74); color: #fff; font-size: .95rem; font-weight: 800; letter-spacing: .01em; }
.video-shell { position: relative; overflow: hidden; aspect-ratio: 16 / 9; border: 4px solid var(--line); border-radius: 18px; background: #05080c; }
.video-shell video { width: 100%; height: 100%; display: block; object-fit: contain; }
.camera-shell video { object-fit: cover; }
.camera-shell.mirrored video { transform: scaleX(-1); }
.visual-status { width: 100%; min-height: 76px; margin-top: 16px; padding: 12px 20px; border: 2px solid; border-radius: 16px; display: flex; justify-content: center; align-items: center; gap: 16px; font-size: 1.3rem; }
.visual-status > span { font-size: 2rem; }
.visual-status.wait { color: #8a6200; border-color: #d8a73c; background: #fff6d9; }
.visual-status.ready { color: #22683d; border-color: var(--green); background: #e6f4eb; }
.visual-status.error { color: #8f322f; border-color: var(--red); background: #fdebea; }
.visual-status.recording { color: #fff; border-color: #a52925; background: var(--red); animation: pulse 1s ease-in-out infinite; }
:root[data-theme="dark"] .visual-status.wait { color: #ffda7a; background: #433717; }
:root[data-theme="dark"] .visual-status.ready { color: #b8e9c9; background: #1d3e29; }
@keyframes pulse { 50% { filter: brightness(1.2); } }
.mirror-toggle { width: fit-content; margin: 12px auto 0; display: flex; align-items: center; gap: 9px; cursor: pointer; font-weight: 800; }
.mirror-toggle input { width: 21px; height: 21px; accent-color: var(--blue); }
.mirror-toggle small { color: var(--muted); font-weight: 500; }
.camera-setup .primary-button { display: block; margin-left: auto; margin-right: auto; }
.camera-setup { padding-top: 9px; }

.record-screen { padding: 7px clamp(16px, 2.5vw, 34px) clamp(16px, 2.5vw, 34px); }
.record-progress-head { min-width: 0; display: flex; justify-content: space-between; gap: 12px; align-items: center; white-space: nowrap; }
.record-word-line { min-width: 0; display: flex; align-items: baseline; gap: 9px; overflow: hidden; }
.record-progress-head h2 { flex: 0 0 auto; margin: 0; color: var(--navy); font-size: clamp(1.45rem, 2.2vw, 2rem); line-height: 1; }
:root[data-theme="dark"] .record-progress-head h2 { color: #a9c9ff; }
.record-progress-head small { min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--muted); font-size: .74rem; }
.record-progress-head > div > span { flex: 0 0 auto; color: var(--green); font-weight: 900; }
.counter-block { flex: 0 0 auto; display: flex; align-items: baseline; text-align: right; gap: 8px; }
.counter-block strong { font-size: .95rem; }
.counter-block span { color: var(--muted) !important; }
.progress-track { height: 5px; margin: 4px 0 7px; border-radius: 999px; background: var(--soft); overflow: hidden; }
.progress-track span { display: block; width: 0; height: 100%; background: var(--green); transition: width .3s; }
.record-videos { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.record-videos h3 { margin: 0 0 8px; font-size: 1.05rem; }
.record-videos h3 span { color: var(--blue); }
.reference-shell { border-color: var(--blue); }
.record-screen .camera-shell video { object-fit: contain; }
.camera-shell.ready { border-color: var(--green); box-shadow: 0 0 0 4px rgba(54, 141, 88, .18); }
.camera-shell.bad { border-color: var(--red); }
.camera-shell.st-prepare { border-color: #f59e0b; box-shadow: 0 0 0 3px rgba(245,158,11,.35); }
.camera-shell.st-wait { border-color: #0070f3; box-shadow: 0 0 0 3px rgba(0,112,243,.4); animation: pulseSoft 1.2s ease-in-out infinite; }
.camera-shell.st-rec { border-color: #dc2626; box-shadow: 0 0 0 4px rgba(220,38,38,.45); }
.camera-shell.st-ok { border-color: #10b981; box-shadow: 0 0 0 3px rgba(16,185,129,.4); }
.camera-shell.st-error { border-color: var(--red); }
.video-panel-tag { position: absolute; top: 10px; left: 10px; z-index: 3; padding: 4px 12px; border-radius: 999px; color: #fff; background: rgba(0,0,0,.62); font-size: 14.5px; font-weight: 700; }
.video-empty { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; align-items: center; color: #fff; background: #152030; text-align: center; }
.video-empty span { width: 58px; height: 58px; display: grid; place-items: center; border: 3px solid #f0b34d; border-radius: 50%; color: #f0b34d; font-weight: 900; font-size: 2rem; }
.video-empty strong { margin-top: 14px; font-size: 1.15rem; }
.video-empty small { color: #aab6c8; }
.video-tools { display: flex; gap: 8px; align-items: center; min-height: 48px; }
.video-tools button { border: 1px solid var(--line); border-radius: 10px; min-height: 38px; padding: 6px 12px; background: var(--card); color: var(--ink); cursor: pointer; }
.video-tools span { margin-left: auto; color: var(--muted); font-size: .84rem; }
.capture-banner { margin-bottom: 7px; padding: 8px 14px; border-radius: 12px; color: var(--ink); background: color-mix(in srgb, var(--muted) 12%, transparent); text-align: center; font-size: clamp(1rem, 1.8vw, 1.35rem); font-weight: 800; line-height: 1.25; transition: background .2s, color .2s; }
.capture-banner.st-prepare { color: #1a1200; background: #f59e0b; }
.capture-banner.st-wait { color: #fff; background: #0070f3; animation: pulseSoft 1.2s ease-in-out infinite; }
.capture-banner.st-rec { color: #fff; background: #dc2626; }
.capture-banner.st-send { background: color-mix(in srgb, var(--muted) 25%, transparent); }
.capture-banner.st-ok { color: #04170f; background: #10b981; }
.capture-banner.st-error { color: #fff; background: var(--red); }
@keyframes pulseSoft { 0%,100% { filter: brightness(1); } 50% { filter: brightness(1.22); } }
.countdown { position: absolute; inset: 0; z-index: 4; display: flex; align-items: center; justify-content: center; color: #fff; font-size: clamp(110px, 22vw, 190px); font-weight: 900; text-shadow: 0 4px 26px rgba(0,0,0,.85); pointer-events: none; }
.recording-badge { position: absolute; right: 10px; top: 10px; z-index: 4; border-radius: 999px; padding: 5px 14px; color: #fff; background: #dc2626; font-size: 16px; font-weight: 800; letter-spacing: .5px; }
.recording-badge b { display: inline; width: auto; height: auto; border-radius: 0; background: none; animation: blink 1s steps(2, start) infinite; }
.hand-chip { position: absolute; left: 50%; bottom: 10px; z-index: 4; transform: translateX(-50%); padding: 6px 18px; border-radius: 999px; color: #bbb; background: rgba(0,0,0,.6); text-align: center; white-space: nowrap; font-size: 16.5px; font-weight: 700; }
.hand-chip.on { color: #04170f; background: #10b981; }
.take-check { position: absolute; inset: 0; z-index: 5; display: flex; align-items: center; justify-content: center; color: #10b981; opacity: 0; pointer-events: none; font-size: clamp(90px,18vw,150px); font-weight: 900; text-shadow: 0 4px 22px rgba(0,0,0,.8); }
.take-check.flash { animation: checkFlash 1s ease-out; }
@keyframes checkFlash { 0% { opacity: 0; transform: scale(.6); } 18% { opacity: 1; transform: scale(1.06); } 55% { opacity: 1; transform: scale(1); } 100% { opacity: 0; } }
.camera-caption { display: flex; justify-content: space-between; align-items: center; min-height: 48px; padding: 6px 4px 0; color: var(--muted); font-size: 13.5px; }
@keyframes blink { 50% { opacity: 0; } }
.take-dots { display: flex; justify-content: center; gap: 10px; margin: 12px 0 0; }
.take-dots span { width: 18px; height: 18px; border: 2px solid var(--muted); border-radius: 50%; }
.take-dots span.done { background: var(--green); border-color: var(--green); }
.take-dots span.current { border-color: var(--red); box-shadow: inset 0 0 0 4px var(--card); background: var(--red); }
.review-panel { width: min(720px, 100%); margin: 16px auto 0; padding: 14px; border-radius: 16px; border: 1px solid var(--line); background: var(--soft); text-align: center; }
.review-panel video { width: 100%; max-height: 42vh; border-radius: 12px; background: #000; }
.review-panel p { margin-bottom: 0; color: var(--muted); }
.record-screen .primary-button { display: block; margin-left: auto; margin-right: auto; }
.batch-review-screen { padding: 14px clamp(18px, 3vw, 42px) 22px; }
.batch-review-head { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 10px; }
.batch-review-head span { color: var(--green); font-weight: 900; }
.batch-review-head h2 { display: inline; margin: 0 10px; color: var(--navy); font-size: clamp(1.6rem, 2.5vw, 2.25rem); }
.batch-review-head small { color: var(--muted); }
.batch-review-head > strong { flex: 0 0 auto; padding: 8px 14px; border-radius: 999px; color: #176436; background: #e6f4eb; }
:root[data-theme="dark"] .batch-review-head h2 { color: #a9c9ff; }
:root[data-theme="dark"] .batch-review-head > strong { color: #b8e9c9; background: #1d3e29; }
.batch-review-videos { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.batch-review-videos article { min-width: 0; }
.batch-review-videos h3 { margin: 0 0 7px; text-align: center; }
.batch-review-videos video { width: 100%; height: 100%; object-fit: contain; }
.batch-review-missing { position: absolute; inset: 0; display: grid; place-items: center; padding: 20px; color: #d7e0ee; background: #152030; text-align: center; font-weight: 800; }
.batch-review-actions { display: grid; grid-template-columns: 1fr 1fr 1.35fr; gap: 12px; margin-top: 16px; }
.batch-review-actions .primary-button { width: 100%; min-height: 58px; margin: 0; font-size: 1.08rem; }
.batch-review-screen.single-take .batch-review-videos { grid-template-columns: minmax(0, 760px); justify-content: center; }
.batch-review-screen.single-take .batch-review-videos article:nth-child(2),
.batch-review-screen.single-take #redoTake2Button { display: none; }
.batch-review-screen.single-take .batch-review-actions { grid-template-columns: minmax(180px, .65fr) minmax(240px, 1fr); justify-content: center; }

.break-timer { margin: 18px 0; color: var(--navy); font-size: 4.5rem; font-weight: 900; font-variant-numeric: tabular-nums; }
.finish-stats { display: flex; gap: 14px; margin: 20px 0; }
.finish-stats div { min-width: 160px; display: grid; padding: 20px; border: 1px solid var(--line); border-radius: 18px; background: var(--soft); }
.finish-stats strong { color: var(--navy); font-size: 2.5rem; }
.finish-stats span { color: var(--muted); }

dialog { border: 0; padding: 0; border-radius: 20px; color: var(--ink); background: var(--card); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(10, 18, 30, .62); }
.dialog-card { width: min(520px, calc(100vw - 32px)); padding: 24px; }
.dialog-card h2 { margin-top: 0; }
.dialog-choices { display: grid; gap: 9px; }
.dialog-choices button { min-height: 58px; border: 1px solid var(--line); border-radius: 12px; background: var(--soft); color: var(--ink); text-align: left; padding: 10px 14px; cursor: pointer; }
.dialog-choices button:hover { border-color: var(--blue); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100; max-width: min(680px, calc(100% - 32px)); padding: 13px 18px; border-radius: 12px; color: #fff; background: #25364f; box-shadow: var(--shadow); font-weight: 700; }
.toast.error { background: var(--red); }
.toast.success { background: var(--green); }

@media (max-width: 1050px) {
  .record-topbar-main { align-items: flex-start; padding: 12px 0; flex-wrap: wrap; }
  .record-brand { flex: 1; }
  .app-nav { order: 3; flex-basis: 100%; justify-content: flex-start; overflow-x: auto; flex-wrap: nowrap; }
  .active-signer-badge { margin-left: auto; }
  .setup-grid, .record-videos { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .record-topbar-main, .portal-shell { width: min(100% - 20px, 1460px); }
  .record-brand p { max-width: 230px; }
  .active-signer-badge { flex-basis: auto; max-width: 48vw; }
  .active-signer-badge img { width: 44px; height: 44px; }
  .signer-active .record-topbar-main { min-height: 56px; padding: 4px 0; align-items: center; flex-wrap: nowrap; gap: 8px; }
  .signer-active .record-brand { min-width: auto; flex: 0 0 auto; }
  .signer-active .record-brand .eyebrow, .signer-active .record-brand p, .signer-active .app-nav { display: none; }
  .signer-active .record-brand h1 { font-size: 1.05rem; }
  .signer-active .active-signer-badge { flex: 1 1 auto; max-width: none; }
  .signer-active .utility-actions { gap: 4px; }
  .signer-active .icon-button, .signer-active .more-menu summary { width: 38px; height: 38px; }
  .screen { min-height: calc(100vh - 170px); border-radius: 18px; padding: 22px 16px; }
  .signer-grid { grid-template-columns: 1fr; }
  .signer-list-head { align-items: stretch; flex-direction: column; }
  .add-signer-button { width: 100%; }
  .promise-grid { grid-template-columns: 1fr; }
  .promise-grid article { grid-template-columns: 42px 1fr; text-align: left; align-items: center; }
  .promise-grid article small { grid-column: 2; }
  .practice-steps { grid-template-columns: 1fr; }
  .practice-steps div { grid-template-columns: 38px 1fr; justify-items: start; align-items: center; text-align: left; }
  .choice-row { display: grid; grid-template-columns: 1fr 1fr; }
  .profile-photo-capture { align-items: flex-start; }
  .profile-photo-preview { width: 112px; }
  .compact-workspace .record-topbar-main { min-height: 48px; padding: 4px 0; }
  .compact-workspace .record-brand { min-width: auto; }
  .compact-workspace .record-brand h1 { font-size: 1.05rem; }
  .compact-workspace .active-signer-badge { max-width: min(52vw, 250px); }
  .compact-workspace .app-nav { display: none; }
  .compact-workspace .portal-shell { margin-top: 5px; }
  .compact-workspace .screen.camera-setup,
  .compact-workspace .screen.record-screen,
  .compact-workspace .screen.batch-review-screen { padding: 6px 12px 18px; min-height: calc(100vh - 62px); }
  .compact-camera-head p { font-size: .78rem; }
  .record-progress-head h2 { font-size: 1.35rem; }
  .record-progress-head small { display: none; }
  .counter-block { gap: 5px; font-size: .78rem; }
  .mirror-toggle { flex-wrap: wrap; justify-content: center; }
  .mirror-toggle small { width: 100%; text-align: center; }
  .video-tools { flex-wrap: wrap; }
  .video-tools span { width: 100%; margin: 0; }
  .batch-review-head { align-items: flex-start; }
  .batch-review-head small { display: block; margin-top: 4px; }
  .batch-review-head > strong { display: none; }
  .batch-review-videos { grid-template-columns: 1fr 1fr; gap: 8px; }
  .batch-review-videos .video-shell { border-width: 2px; border-radius: 12px; }
  .batch-review-actions { grid-template-columns: 1fr 1fr; gap: 8px; }
  .batch-review-actions .primary-button { grid-column: 1 / -1; }
  .batch-review-screen.single-take .batch-review-actions { grid-template-columns: 1fr; }
  .finish-stats div { min-width: 120px; }
}
