html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

h1:focus {
    outline: none;
}

a, .btn-link {
    color: #0071c1;
}

.btn-primary {
    color: #fff;
    background-color: #1b6ec2;
    border-color: #1861ac;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.content {
    padding-top: 1.1rem;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: red;
}

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5I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I2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.loading-progress {
    position: relative;
    display: block;
    width: 8rem;
    height: 8rem;
    margin: 20vh auto 1rem auto;
}

    .loading-progress circle {
        fill: none;
        stroke: #e0e0e0;
        stroke-width: 0.6rem;
        transform-origin: 50% 50%;
        transform: rotate(-90deg);
    }

        .loading-progress circle:last-child {
            stroke: #1b6ec2;
            stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
            transition: stroke-dasharray 0.05s ease-in-out;
        }

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

    .loading-progress-text:after {
        content: var(--blazor-load-percentage-text, "Loading");
    }

code {
    color: #c02d76;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* ===================== UITestersWorkbench ===================== */
:root {
    --bg: #0f1419;
    --panel: #171d26;
    --panel-2: #1e2733;
    --line: #2a3441;
    --text: #e6edf3;
    --muted: #8b98a8;
    --accent: #2dd4bf;
    --accent-2: #38bdf8;
    --warn: #f59e0b;
    --danger: #ef4444;
    --ok: #34d399;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: 'Segoe UI', system-ui, -apple-system, Helvetica, Arial, sans-serif;
    height: 100%;
}

.app-root { height: 100vh; }

code { color: var(--accent); background: rgba(45,212,191,.08); padding: 0 .25rem; border-radius: 4px; }

/* ---- Start screen ---- */
.start-wrap { min-height: 100vh; display: grid; place-items: center; padding: 2rem; }
.start-card {
    width: 100%; max-width: 460px; background: var(--panel); border: 1px solid var(--line);
    border-radius: 16px; padding: 2rem; box-shadow: 0 20px 60px rgba(0,0,0,.45);
}
.start-card .logo { font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; color: var(--accent); }
.start-card .sub { color: var(--muted); font-size: .9rem; line-height: 1.5; margin: .5rem 0 1.5rem; }
.start-card label { display: block; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: .9rem 0 .3rem; }
.start-card input[type=text], .start-card input:not([type]), .start-card select {
    width: 100%; background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
    border-radius: 9px; padding: .6rem .7rem; font-size: .92rem;
}
.start-card .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.start-card .consent { display: flex; gap: .5rem; align-items: flex-start; text-transform: none; letter-spacing: 0; color: var(--text); font-size: .82rem; margin-top: 1.1rem; }
.start-card .consent input { margin-top: .2rem; }
.start-card .err { color: var(--danger); font-size: .85rem; margin-top: .8rem; }
.start-card .hint { color: var(--muted); font-size: .75rem; margin-top: .8rem; }
.integrations { margin-top: 1rem; display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.integrations .lbl { color: var(--muted); font-size: .78rem; }
.chip { font-size: .72rem; padding: .15rem .5rem; border-radius: 999px; border: 1px solid var(--line); }
.chip.on { color: var(--ok); border-color: rgba(52,211,153,.4); background: rgba(52,211,153,.08); }
.chip.off { color: var(--muted); }

button.primary {
    margin-top: 1.3rem; width: 100%; background: linear-gradient(180deg, var(--accent), #14b8a6);
    color: #03201c; font-weight: 700; border: none; border-radius: 10px; padding: .75rem; cursor: pointer; font-size: .95rem;
}
button.primary:disabled { opacity: .45; cursor: not-allowed; }

/* ---- Workbench layout ---- */
.wb { display: flex; flex-direction: column; height: 100vh; }
.wb-top {
    display: flex; align-items: center; gap: .8rem; padding: .55rem .9rem;
    background: var(--panel); border-bottom: 1px solid var(--line);
}
.wb-top .brand { font-weight: 700; color: var(--accent); }
.wb-top .spacer { flex: 1; }
.wb-top button {
    background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
    border-radius: 8px; padding: .4rem .7rem; cursor: pointer; font-size: .82rem;
}
.wb-top button:hover { border-color: var(--accent); }
.wb-top button.danger { color: #fff; background: var(--danger); border-color: var(--danger); }
.urlbar { color: var(--muted); font-size: .82rem; max-width: 40ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: var(--panel-2); padding: .25rem .6rem; border-radius: 6px; }

.rec { display: flex; align-items: center; gap: .4rem; font-size: .78rem; text-transform: capitalize; color: var(--muted); }
.rec .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.rec-recording .dot { background: var(--danger); }
.rec-recording { color: var(--danger); }
.rec-recording .dot { animation: pulse 1.6s infinite; }
.rec-ended .dot { background: var(--muted); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(239,68,68,.55); } 70% { box-shadow: 0 0 0 8px rgba(239,68,68,0); } 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0); } }

.wb-main { flex: 1; display: grid; grid-template-columns: 1fr 380px; min-height: 0; }

.viewport { display: flex; flex-direction: column; min-width: 0; border-right: 1px solid var(--line); }
.screen { flex: 1; display: grid; place-items: center; background: #0a0d12; overflow: auto; padding: .5rem; }
.screen img { max-width: 100%; max-height: 100%; border: 1px solid var(--line); border-radius: 6px; cursor: crosshair; box-shadow: 0 8px 30px rgba(0,0,0,.5); }
.noframe { text-align: center; color: var(--muted); max-width: 480px; padding: 2rem; }
.noframe p { font-size: 1.05rem; color: var(--text); }
.noframe small { display: block; margin-top: .6rem; line-height: 1.5; }

.cmdbar { display: flex; gap: .4rem; padding: .55rem; background: var(--panel); border-top: 1px solid var(--line); }
.cmdbar input { flex: 1; background: var(--panel-2); border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: .5rem .65rem; font-size: .85rem; }
.cmdbar button { background: var(--panel-2); border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: .5rem .7rem; cursor: pointer; }
.cmdbar button:first-of-type { background: var(--accent-2); border-color: var(--accent-2); color: #042033; font-weight: 600; }
.hint-row { color: var(--muted); font-size: .72rem; padding: .25rem .7rem .5rem; background: var(--panel); }

/* ---- Side panel ---- */
.side { display: flex; flex-direction: column; min-height: 0; background: var(--panel); }
.narrate { padding: .7rem; border-bottom: 1px solid var(--line); }
.narrate-row { display: flex; gap: .4rem; }
.narrate-row input { flex: 1; background: var(--panel-2); border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: .55rem .65rem; font-size: .88rem; }
.mic { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; width: 42px; cursor: pointer; font-size: 1rem; }
.mic.live { background: var(--danger); border-color: var(--danger); animation: pulse 1.6s infinite; }
.actions { display: flex; gap: .4rem; margin-top: .5rem; }
.actions button { flex: 1; border-radius: 8px; padding: .55rem; cursor: pointer; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); font-size: .85rem; }
.actions button.warn { background: var(--warn); border-color: var(--warn); color: #2a1a00; font-weight: 600; flex: 2; }

.clarify { margin: .7rem; padding: .7rem; background: rgba(56,189,248,.08); border: 1px solid rgba(56,189,248,.3); border-radius: 10px; }
.clarify .q { font-size: .9rem; margin-bottom: .5rem; }
.clarify .q-row { display: flex; gap: .4rem; }
.clarify input { flex: 1; background: var(--panel-2); border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: .45rem .6rem; }
.clarify button { background: var(--accent-2); border: none; color: #042033; font-weight: 600; border-radius: 8px; padding: .45rem .7rem; cursor: pointer; }

.timeline { flex: 1; overflow-y: auto; padding: .6rem .7rem; display: flex; flex-direction: column; gap: .35rem; }
.tl { font-size: .82rem; line-height: 1.4; padding: .35rem .55rem; border-radius: 7px; background: var(--panel-2); border-left: 3px solid var(--line); word-break: break-word; }
.tl a { color: var(--accent); }
.tl-transcript { border-left-color: var(--muted); }
.tl-clarify { border-left-color: var(--accent-2); }
.tl-step { border-left-color: #a78bfa; color: var(--muted); }
.tl-info { border-left-color: var(--accent-2); }
.tl-success { border-left-color: var(--ok); color: var(--ok); }
.tl-warn { border-left-color: var(--warn); color: var(--warn); }

/* ---- Modals ---- */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; z-index: 1000; padding: 1.5rem; }
.uitwb-modal { display: block; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 1.4rem; width: 100%; max-width: 640px; max-height: 88vh; overflow-y: auto; box-shadow: 0 30px 80px rgba(0,0,0,.6); }
.uitwb-modal h3 { margin: 0 0 1rem; font-size: 1.05rem; }
.uitwb-modal .muted { color: var(--muted); font-weight: 400; font-size: .85rem; }
.uitwb-modal label { display: block; font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: .7rem 0 .25rem; }
.uitwb-modal input, .uitwb-modal textarea, .uitwb-modal select { width: 100%; background: var(--panel-2); border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: .5rem .6rem; font-size: .88rem; font-family: inherit; }
.uitwb-modal .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.uitwb-modal .grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: .7rem; }
.uitwb-modal details { margin-top: .9rem; }
.uitwb-modal summary { cursor: pointer; color: var(--muted); font-size: .82rem; }
.uitwb-modal .preview { background: #0a0d12; border: 1px solid var(--line); border-radius: 8px; padding: .7rem; font-size: .75rem; white-space: pre-wrap; max-height: 240px; overflow: auto; color: var(--muted); }
.uitwb-modal .evlist { font-size: .78rem; color: var(--muted); }
.modal-actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: 1.2rem; }
.modal-actions button { border-radius: 9px; padding: .55rem 1.1rem; cursor: pointer; font-size: .9rem; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); }
.modal-actions button.primary { width: auto; margin: 0; background: linear-gradient(180deg, var(--accent), #14b8a6); color: #03201c; font-weight: 700; border: none; }
.uitwb-modal.feature pre { background: #0a0d12; border: 1px solid var(--line); border-radius: 8px; padding: 1rem; font-size: .8rem; white-space: pre-wrap; color: var(--text); }

/* ---- Nav + admin/data pages ---- */
.appnav { display: flex; align-items: center; gap: 1rem; padding: .6rem 1.2rem; background: var(--panel); border-bottom: 1px solid var(--line); }
.appnav .brand { font-weight: 700; color: var(--accent); text-decoration: none; }
.appnav a { color: var(--muted); text-decoration: none; font-size: .88rem; }
.appnav a:hover { color: var(--text); }
.appnav .spacer { flex: 1; }
.appnav .who { color: var(--text); font-size: .85rem; }
.appnav .logout { color: var(--accent-2); }

.page { max-width: 1000px; margin: 0 auto; padding: 1.5rem 1.2rem 3rem; }
.page h1 { font-size: 1.4rem; margin: .5rem 0 1rem; }
.page .muted { color: var(--muted); font-size: .9rem; }
.page .forbidden { color: var(--warn); }
.page a { color: var(--accent); }

.grid { width: 100%; border-collapse: collapse; margin-top: 1rem; font-size: .88rem; }
.grid th, .grid td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--line); }
.grid th { color: var(--muted); text-transform: uppercase; font-size: .72rem; letter-spacing: .04em; }
.grid tr.total td { font-weight: 700; border-top: 2px solid var(--line); }
.grid td.over { color: var(--danger); font-weight: 700; }
.grid button.link, .page button.link { background: none; border: none; color: var(--accent-2); cursor: pointer; padding: 0; font-size: .85rem; }

.card2 { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 1rem 1.2rem; margin-bottom: 1.2rem; }
.card2 h3 { margin: 0 0 .7rem; font-size: 1rem; }
.form-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.form-row input, .form-row select { background: var(--panel-2); border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: .5rem .6rem; font-size: .88rem; }
.form-row button { background: linear-gradient(180deg, var(--accent), #14b8a6); color: #03201c; font-weight: 700; border: none; border-radius: 8px; padding: .5rem 1rem; cursor: pointer; }
.page .err { color: var(--danger); font-size: .85rem; margin-top: .6rem; }

/* ---- Auth error page (RemoteAuthenticatorView LogInFailed/LogOutFailed) ---- */
.auth-error { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem; background: var(--bg, #0a0d12); }
.auth-error-card { max-width: 440px; width: 100%; text-align: center; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 2rem 1.6rem; }
.auth-error-icon { font-size: 2.4rem; line-height: 1; margin-bottom: .6rem; }
.auth-error-card h1 { font-size: 1.3rem; margin: 0 0 .6rem; color: var(--text); }
.auth-error-msg { color: var(--muted); font-size: .92rem; line-height: 1.5; margin: 0 0 1rem; }
.auth-error-detail { color: var(--danger); font-size: .8rem; word-break: break-word; margin: 0 0 1rem; }
.auth-error-btn { display: inline-block; background: linear-gradient(180deg, var(--accent), #14b8a6); color: #03201c; font-weight: 700; border: none; border-radius: 9px; padding: .6rem 1.4rem; font-size: .95rem; cursor: pointer; }
.auth-error-btn:hover { filter: brightness(1.07); }
.auth-error-redirect { color: var(--muted); font-size: .78rem; margin: .9rem 0 0; }

.wb-frame { display:block; max-width:100%; cursor:default; outline:none; }
.wb-input-badge { position:absolute; top:.4rem; right:.6rem; background:rgba(20,184,166,.9); color:#03201c; font-size:.72rem; font-weight:700; padding:.2rem .5rem; border-radius:6px; pointer-events:none; opacity:0; transition:opacity .15s; }
.screen.wb-stage-focused .wb-input-badge { opacity:1; }
.wb-input-badge kbd { background:rgba(3,32,28,.25); border-radius:3px; padding:0 .2rem; font-family:inherit; }

/* ---- Accessibility utility: visible to assistive tech, removed from visual flow ---- */
.visually-hidden {
    position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
    overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}

/* ---- Responsive: below tablet width, stack the workbench so the fixed 380px side panel
   can't overflow/crush the streaming canvas (the layout has no other breakpoint). ---- */
@media (max-width: 860px) {
    .wb-main { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) minmax(0, 45vh); }
    .viewport { border-right: none; border-bottom: 1px solid var(--line); }
    .side { max-height: 45vh; }
}