* { box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    background: #f5f6f8;
    color: #1a1a1a;
}
.topbar {
    background: #1f2937;
    color: white;
    padding: 0.75rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.topbar a { color: white; text-decoration: none; margin-left: 1rem; }
.topbar .brand { margin-left: 0; font-weight: 600; }
.container { max-width: 760px; margin: 2rem auto; padding: 0 1rem; }
.container.wide { max-width: 1200px; }
.card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem 2rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.card.narrow { max-width: 420px; margin-left: auto; margin-right: auto; }
h1 { font-size: 1.4rem; margin-top: 0; }
h2 { font-size: 1.1rem; }
.muted { color: #666; }
.muted.small { font-size: 0.85rem; }
.error { color: #b91c1c; font-weight: 600; }
.success { color: #15803d; font-weight: 600; }
label { display: block; margin-bottom: 1rem; }
input[type=email], input[type=password] {
    width: 100%; padding: 0.5rem; margin-top: 0.25rem; border: 1px solid #ccc; border-radius: 4px;
}
button, .button {
    background: #2563eb; color: white; border: none; padding: 0.6rem 1.2rem;
    border-radius: 6px; cursor: pointer; font-size: 1rem; text-decoration: none; display: inline-block;
}
button:hover, .button:hover { background: #1d4ed8; }
button:disabled { background: #9ca3af; cursor: not-allowed; }
audio { width: 100%; margin: 1rem 0; }
fieldset { border: 1px solid #e5e7eb; border-radius: 6px; padding: 1rem; margin-bottom: 1rem; }
legend { font-weight: 600; padding: 0 0.4rem; }
.option { font-weight: normal; display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; }
.option input { margin: 0; }
.scale-row { display: flex; gap: 1rem; }
.scale-option { flex-direction: column; }
.stage-label { font-weight: 700; text-transform: uppercase; font-size: 0.8rem; color: #2563eb; letter-spacing: 0.03em; }
.transcript dt { font-weight: 600; margin-top: 0.5rem; }
.transcript dd { margin: 0.15rem 0 0 0; color: #333; }
.progress-summary { font-weight: 600; }
.progress-bar { background: #e5e7eb; border-radius: 6px; height: 10px; overflow: hidden; margin-bottom: 1rem; }
.progress-bar-fill { background: #2563eb; height: 100%; }
.sample-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.sample-table th, .sample-table td { text-align: left; padding: 0.4rem 0.6rem; border-bottom: 1px solid #eee; }
.row-complete { color: #15803d; }

/* -- Marked audio player (decision-window / target-action-window overlay) -- */
.marked-player { margin: 0.75rem 0 0.25rem; }
.marked-player audio { margin: 0 0 0.3rem; }
.marker-strip {
    position: relative;
    height: 22px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}
.marker-region {
    position: absolute;
    top: 0; bottom: 0;
    background: rgba(37, 99, 235, 0.30);
    border-left: 2px solid #2563eb;
    border-right: 2px solid #2563eb;
}
.marker-region.action-window {
    background: rgba(37, 99, 235, 0.30);
    border-left: 2px solid #2563eb;
    border-right: 2px solid #2563eb;
}
.marker-region.target-speaker-window {
    background: rgba(220, 38, 38, 0.22);
    border-left: 2px solid #dc2626;
    border-right: 2px solid #dc2626;
    /* drawn slightly shorter so it doesn't fully hide an overlapping
       action-window region underneath -- both stay visible/legible */
    top: 6px; bottom: 6px;
}
.marker-playhead {
    position: absolute;
    top: 0; bottom: 0;
    width: 2px;
    background: #111827;
    left: 0%;
    z-index: 2;
}
.marker-legend { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 0.35rem; font-size: 0.8rem; }
.marker-legend-item { color: #444; }
.marker-legend-item::before { content: "\25A0"; margin-right: 0.35rem; }
.marker-legend-item.decision-window { color: #2563eb; }
.marker-legend-item.action-window { color: #2563eb; }
.marker-legend-item.target-speaker-window { color: #dc2626; }

/* -- Context blocks shown before Stage2/3 questions -- */
.context-block { background: #f8fafc; border: 1px solid #e5e7eb; border-radius: 6px; padding: 0.85rem 1rem; margin-bottom: 0.85rem; }
.context-block h3 { margin: 0 0 0.35rem; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.03em; color: #555; }
.context-block p { margin: 0; }
.context-note { font-weight: 600; color: #333; margin: 0.4rem 0 0.6rem; }
.transcript-line { margin-bottom: 0.5rem; }
.transcript-line .speaker-label { font-weight: 700; color: #1f2937; margin-right: 0.4rem; }
.transcript-line .speaker-label.speaker-b { color: #2563eb; }
.transcript-line .speaker-label.speaker-a { color: #444; }
.transcript-line .speaker-label.speaker-other { color: #b45309; }

/* -- Answer-lock reminder -- */
.lock-notice {
    background: #fffbeb; border: 1px solid #fde68a; color: #92400e;
    border-radius: 6px; padding: 0.6rem 0.85rem; font-size: 0.85rem; margin-bottom: 1rem;
}
.lock-notice.admin-notice { background: #eef2ff; border-color: #c7d2fe; color: #3730a3; }

/* -- Admin free-roam bar (edit/jump between steps; never shown to regular annotators) -- */
.admin-bar {
    background: #312e81; color: #e0e7ff; border-radius: 6px; padding: 0.5rem 0.85rem;
    font-size: 0.85rem; margin-bottom: 1rem;
}
.admin-bar a { color: #c7d2fe; text-decoration: underline; margin: 0 0.3rem; }
.admin-bar strong { margin: 0 0.3rem; }

/* -- Sample nav footer (prev/next sample, dashboard) -- */
.sample-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 1rem; font-size: 0.9rem; }
.sample-nav a { color: #2563eb; text-decoration: none; }
.sample-nav a:hover { text-decoration: underline; }
.sample-nav .disabled { color: #aaa; }

.finalize-box { border: 2px solid #15803d; background: #f0fdf4; border-radius: 8px; padding: 1.25rem; margin-top: 1rem; }
.finalized-banner { border: 2px solid #2563eb; background: #eff6ff; border-radius: 8px; padding: 1.25rem; margin-top: 1rem; }

/* -- Admin browse tables -- */
.admin-links { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 0.75rem 0 0; }
.filter-pills { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.75rem 0 1rem; }
.filter-pills a {
    font-size: 0.8rem; padding: 0.2rem 0.6rem; border-radius: 999px;
    background: #e5e7eb; color: #1f2937; text-decoration: none;
}
.filter-pills a.active { background: #2563eb; color: white; }
.answer-matrix { font-size: 0.82rem; }
.answer-matrix th { white-space: nowrap; }
.answer-matrix .empty { color: #aaa; }
.badge {
    display: inline-block; font-size: 0.7rem; font-weight: 600; letter-spacing: 0.03em;
    text-transform: uppercase; padding: 0.1rem 0.4rem; border-radius: 4px;
    background: #e5e7eb; color: #374151;
}
.badge.admin { background: #e0e7ff; color: #3730a3; }
.badge.synthetic { background: #fef3c7; color: #92400e; }
.badge.real { background: #dcfce7; color: #166534; }
