/* ScreenCapture shared styles — matches the MSP Level-1 Assist design system
   (light theme, topbar nav + avatar menu, card/badge primitives) so the two
   apps look like one product. */
:root {
  --bg: #f5f6f8; --panel: #ffffff; --panel2: #eef1f5; --border: #e1e5ea;
  --text: #1c2430; --muted: #66707d; --primary: #1e6fd9; --primary-h: #1a5cb8;
  --danger: #cc3b3b; --success: #1e9e5a; --warn: #c98a12; --radius: 10px;
  --header-h: 56px;   /* one header height for every page (nav / recorder / landing) */
}
* { box-sizing: border-box; }
html, body { max-width: 100%; overflow-x: hidden; }
body {
  margin: 0; font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.5; overflow-wrap: anywhere;
}
img, video { max-width: 100%; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); font-size: .9rem; }
.small { font-size: .85rem; }
h1, h2, h3 { margin: 0 0 .5rem; }
.page-intro { color: var(--muted); font-size: .9rem; margin: 4px 0 0; }

/* Buttons */
.btn {
  display: inline-block; border: 1px solid transparent; background: var(--panel2);
  color: var(--text); padding: .5rem .9rem; border-radius: 6px; cursor: pointer;
  font-size: .9rem; font-family: inherit; text-decoration: none;
}
.btn:hover { filter: brightness(.97); text-decoration: none; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-h); filter: none; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { background: var(--panel2); color: var(--text); }
.btn.big { padding: .75rem 1.3rem; font-size: 1rem; }
.btn.small { padding: .3rem .6rem; font-size: .8rem; }
.btn:disabled { opacity: .5; cursor: default; }

/* Top navigation (rendered by common.js mountNav) */
.topbar {
  background: var(--panel); border-bottom: 1px solid var(--border); padding: 0 20px;
  display: flex; align-items: stretch; gap: 6px; flex-wrap: wrap;
  min-height: var(--header-h);
}
.topbar .brand { display: flex; align-items: center; font-size: 15px; font-weight: 700;
  color: var(--text); padding: 0 12px 0 0; margin-right: 6px; }
.topbar nav { display: flex; align-items: stretch; gap: 2px; flex: 1; flex-wrap: wrap; }
.topbar .navlink { display: flex; align-items: center; color: var(--muted); font-size: 14px;
  padding: 0 12px; border-bottom: 2px solid transparent; }
.topbar .navlink:hover { color: var(--text); text-decoration: none; }
.topbar .navlink.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* Profile menu (avatar + dropdown), pinned to the right */
.profile { position: relative; margin-left: auto; display: flex; align-items: center; }
.profile .avatar { width: 32px; height: 32px; border-radius: 50%; border: 0;
  background: var(--primary); color: #fff; font-size: 13px; font-weight: 700; cursor: pointer;
  display: flex; align-items: center; justify-content: center; padding: 0; }
.profile .avatar:hover { filter: brightness(1.05); }
.profile-menu { display: none; position: absolute; right: 0; top: 44px; z-index: 50;
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px; min-width: 190px;
  box-shadow: 0 6px 24px rgba(0,0,0,.12); padding: 12px 14px; }
.profile.open .profile-menu { display: block; }
.profile-name { font-weight: 600; font-size: 14px; }
.profile-email { color: var(--muted); font-size: 12px; margin-top: 2px; word-break: break-all; }
.profile-role { color: var(--primary); font-size: 12px; margin-top: 4px; text-transform: capitalize; }
.profile-sep { border-top: 1px solid var(--border); margin: 10px -14px; }
.profile-item { display: block; color: var(--text); font-size: 14px; padding: 4px 0; }
.profile-item:hover { color: var(--primary); text-decoration: none; }

main { max-width: 1000px; margin: 24px auto; padding: 0 16px; }
.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; margin-bottom: 20px;
}
.card h1, .card h2 { font-size: 1.05rem; }
.row { display: flex; gap: .8rem; flex-wrap: wrap; align-items: center; margin-top: 1rem; }

/* Forms */
.field { display: block; margin-bottom: 1rem; }
.field span { display: block; margin-bottom: .3rem; font-weight: 500; font-size: .9rem; }
.field.consent { display: flex; gap: .55rem; align-items: flex-start; }
.field.consent input { width: auto; margin-top: .2rem; flex: none; }
.field.consent span { display: inline; margin-bottom: 0; font-weight: 400; }
label { font-size: .9rem; }
input, textarea, select {
  width: 100%; padding: .55rem .7rem; border-radius: 6px; border: 1px solid var(--border);
  background: #fff; color: var(--text); font-family: inherit; font-size: .9rem;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--primary); }

/* Colour picker field (swatch + hex text). */
.color-row { display: flex; align-items: center; gap: .5rem; }
.color-row input[type="text"] { flex: 1; }
.color-swatch { flex: none; width: 46px; height: 38px; padding: 3px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--panel); cursor: pointer; }

.banner { padding: .8rem 1rem; border-radius: 8px; margin-bottom: 1rem; }
.banner.warn { background: #faf1de; border: 1px solid #f0d9a6; color: #8a5e0a; }
.banner.err { background: #fbe9e9; border: 1px solid #f3cfcf; color: var(--danger); }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .85rem; }
th, td { text-align: left; padding: .6rem .55rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }

/* Status pills (used as .tag and .badge across the pages) */
.tag, .badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px;
  font-weight: 600; white-space: nowrap; background: var(--panel2); color: var(--muted); border: 0; }
.tag.green, .badge.b-analyzed { background: #e6f5ec; color: var(--success); }
.tag.amber, .badge.b-partial { background: #faf1de; color: var(--warn); }
.tag.red, .badge.b-failed { background: #fbe9e9; color: var(--danger); }

/* Recorder (public end-user page) — same light theme */
body.recorder { background: var(--bg); min-height: 100vh; }
/* Recording-screen header bar: the logo (or app name) lives here, aligned with
   the content column below. */
.recorder-topbar { background: var(--panel); border-bottom: 1px solid var(--border);
  padding: 0 20px; min-height: var(--header-h); display: flex; align-items: center; }
/* Logo sits at the far left of the bar (like the main app's top nav), not indented
   to the centred content column. */
.recorder-topbar-inner { display: flex; align-items: center; gap: .7rem; }
.recorder-topbar .brand-logo { max-width: 240px; }  /* height inherits .brand-logo (30px) so it matches the landing/nav logo */
.recorder-brand { font-size: 15px; font-weight: 700; color: var(--text); }  /* matches the nav/landing wordmark */
.recorder-shell { max-width: 640px; margin: 0 auto; padding: 1.6rem 1.2rem 2rem; }
.recorder-intro { text-align: center; margin: 0 0 1.3rem; }
/* Admin-uploaded logos: in the top nav (brand-logo) and on the recorder/login
   headers (brand-logo-lg). object-fit keeps any aspect ratio without stretching. */
.brand-logo { height: 30px; max-width: 200px; object-fit: contain; display: block; }
.brand-logo-lg { max-height: 64px; max-width: min(280px, 80%); object-fit: contain;
  display: block; margin: 0 auto .6rem; }

/* Branding upload section on the Settings page. */
.brand-asset { display: flex; gap: 1rem; align-items: flex-start; flex-wrap: wrap;
  padding: .8rem 0; border-top: 1px solid var(--border); }
.brand-asset:first-of-type { border-top: 0; }
.brand-preview { flex: 0 0 auto; width: 130px; min-height: 64px; display: flex;
  align-items: center; justify-content: center; padding: 8px; border: 1px solid var(--border);
  border-radius: 8px; background: var(--panel2);
  background-image: linear-gradient(45deg, #0001 25%, transparent 25%, transparent 75%, #0001 75%),
    linear-gradient(45deg, #0001 25%, transparent 25%, transparent 75%, #0001 75%);
  background-size: 14px 14px; background-position: 0 0, 7px 7px; }
.brand-preview img { max-width: 114px; max-height: 80px; object-fit: contain; }
.brand-controls { flex: 1; min-width: 230px; display: flex; flex-direction: column; gap: .4rem; }
.field-label { font-weight: 600; font-size: .9rem; }
.preview { width: 100%; border-radius: 10px; background: #000; aspect-ratio: 16/9; margin: 1rem 0; }
.rec-status { display: flex; align-items: center; gap: .6rem; font-weight: 600; }
.rec-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--danger);
  animation: pulse 1.2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .3; } }
.timer { font-variant-numeric: tabular-nums; font-size: 1.2rem; }

.preview-wrap { position: relative; margin: 1rem 0; }
.preview-wrap .preview { margin: 0; }

/* Microphone mute button: a mic icon that turns red with a slash when muted,
   plus a live level meter ("sound bar") that reacts to the microphone. */
.mic-row { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; margin: .3rem 0 .35rem; }
.mic-btn { display: inline-flex; align-items: center; justify-content: center;
  width: 46px; height: 46px; padding: 0; border-radius: 50%; flex: none;
  background: var(--panel2); border: 1px solid var(--border); color: var(--primary);
  cursor: pointer; transition: color .15s, border-color .15s, background .15s, box-shadow .15s; }
.mic-btn svg { width: 24px; height: 24px; }
.mic-btn:hover { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 14%, transparent); }
.mic-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.mic-btn:disabled { opacity: .5; cursor: not-allowed; color: var(--muted); box-shadow: none; }
.mic-btn .mic-slash { opacity: 0; transition: opacity .15s; }   /* hidden while the mic is live */
.mic-btn.muted { color: #dc2626; border-color: #dc2626; background: rgba(220,38,38,.10); box-shadow: none; }
.mic-btn.muted .mic-slash { opacity: 1; }                       /* red line across when muted */

/* Level meter: a row of bars that rise with input; scaled via transform in JS. */
.mic-meter { display: inline-flex; align-items: center; gap: 3px; height: 26px; flex: none; }
.mic-meter > span { display: block; width: 3px; height: 100%; border-radius: 3px;
  transform: scaleY(.10); transform-origin: bottom;
  background: linear-gradient(to top, var(--primary), color-mix(in srgb, var(--primary) 45%, #ffffff));
  transition: transform .05s linear, background .2s; }
.mic-meter.idle > span { background: var(--border); }   /* greyed when muted / no mic */

.success-card { text-align: center; }
.success-card h2 { color: var(--success); font-size: 1.5rem; }

.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: flex;
  align-items: center; justify-content: center; }
.overlay-box { text-align: center; background: var(--panel); padding: 28px 36px; border-radius: 12px; }
/* Modal "screen pop" (e.g. the recording player) — sits over the page, which stays put. */
.modal-box { background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  padding: 20px; width: min(820px, 92vw); max-height: 88vh; overflow-y: auto;
  box-shadow: 0 12px 40px rgba(0,0,0,.35); text-align: left; }
.spinner { width: 44px; height: 44px; border: 4px solid var(--border);
  border-top-color: var(--primary); border-radius: 50%; margin: 0 auto 1rem;
  animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Landing (public home) — built from the app's own header + card primitives so it
   feels like part of the product, not a separate site. */
.landing-staff { margin-left: auto; }   /* "Staff sign in" pinned right in the shared topbar */

.landing { max-width: 1000px; margin: 24px auto; padding: 0 16px; }

/* Hero card: copy on the left, a small "recording window" illustration on the right. */
.landing-hero { display: flex; gap: 2rem; align-items: center; padding: 2rem 2rem; }
.landing-hero-copy { flex: 1 1 340px; min-width: 0; }
.landing-eyebrow { display: inline-block; font-size: 12px; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase; color: var(--primary);
  background: var(--panel2); padding: 4px 10px; border-radius: 999px; margin-bottom: .9rem; }
.landing-title { font-size: 1.9rem; line-height: 1.2; margin: 0 0 .8rem; }
.landing-sub { color: var(--muted); font-size: 1.02rem; margin: 0 0 1.4rem; max-width: 46ch; }
.landing-cta { display: flex; flex-direction: column; align-items: flex-start; gap: .55rem; }
.landing-record { display: inline-flex; align-items: center; gap: .55rem; }
.landing-rec-dot { width: 10px; height: 10px; border-radius: 50%; background: #fff;
  box-shadow: 0 0 0 3px rgba(255,255,255,.35); animation: landing-pulse 1.6s ease-in-out infinite; }
.landing-reassure { font-size: .85rem; }
@keyframes landing-pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

/* The illustrative browser/recorder window. */
.landing-visual { flex: 1 1 300px; display: flex; justify-content: center; min-width: 0; }
.landing-window { width: 100%; max-width: 340px; border: 1px solid var(--border);
  border-radius: 12px; overflow: hidden; background: var(--panel);
  box-shadow: 0 12px 30px rgba(28,36,48,.10); }
.landing-window-bar { display: flex; align-items: center; gap: 6px; padding: 9px 12px;
  background: var(--panel2); border-bottom: 1px solid var(--border); }
.landing-dot { width: 10px; height: 10px; border-radius: 50%; }
.landing-dot.r { background: #ef6a5f; } .landing-dot.y { background: #f4bf4f; }
.landing-dot.g { background: #61c556; }
.landing-rec-badge { margin-left: auto; display: inline-flex; align-items: center; gap: 5px;
  font-size: 10px; font-weight: 700; letter-spacing: .08em; color: var(--danger); }
.landing-rec-badge .landing-rec-dot { background: var(--danger); box-shadow: none; width: 8px; height: 8px; }
.landing-window-body { padding: 18px 16px 20px; }
.landing-skel { height: 10px; border-radius: 5px; background: var(--panel2); margin-bottom: 11px; }
.landing-skel.w90 { width: 90%; } .landing-skel.w70 { width: 70%; } .landing-skel.w50 { width: 50%; }
.landing-wave { display: flex; align-items: center; gap: 4px; height: 44px; margin-top: 18px; }
.landing-wave span { flex: 1; border-radius: 3px; background: var(--primary); opacity: .8;
  animation: landing-wave 1.1s ease-in-out infinite; }
.landing-wave span:nth-child(odd) { animation-delay: .15s; }
.landing-wave span:nth-child(3n) { animation-delay: .35s; }
.landing-wave span:nth-child(4n) { animation-delay: .5s; }
@keyframes landing-wave { 0%,100% { height: 22%; } 50% { height: 100%; } }

/* Three how-it-works steps. */
.landing-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.landing-step { margin: 0; }
.landing-step-num { width: 30px; height: 30px; border-radius: 50%; background: var(--primary);
  color: #fff; font-weight: 700; font-size: 14px; display: flex; align-items: center;
  justify-content: center; margin-bottom: .7rem; }
.landing-step h3 { margin: 0 0 .35rem; font-size: 1.05rem; }
.landing-step p { margin: 0; }

.landing-foot { text-align: center; margin: 8px 0 4px; font-size: .85rem; }

@media (max-width: 760px) {
  .landing-hero { flex-direction: column; align-items: stretch; text-align: left; }
  .landing-visual { order: -1; }
  .landing-title { font-size: 1.6rem; }
  .landing-steps { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .landing-rec-dot, .landing-wave span { animation: none; }
}

/* Login */
.login-shell { max-width: 360px; margin: 10vh auto; padding: 1.5rem; }
.login-shell h1 { text-align: center; font-size: 1.2rem; }
.divider { text-align: center; color: var(--muted); margin: 1rem 0; font-size: 12px; }

/* Integration setup docs */
.doc { margin: 0 0 1rem; }
.doc p { margin: .4rem 0; }
.doc ol { margin: .4rem 0 .4rem 1.1rem; padding: 0; }
.doc li { margin: .25rem 0; }
.doc code { background: var(--panel2); padding: 1px 5px; border-radius: 4px;
  font-size: .85em; overflow-wrap: anywhere; }

.copy-row { display: flex; gap: .5rem; align-items: center; }
.copy-row input { font-family: monospace; font-size: .82rem; }
.empty { text-align: center; color: var(--muted); padding: 2rem; }

/* The HTML `hidden` attribute must always win, even over class display rules. */
[hidden] { display: none !important; }
