@import url('https://fonts.googleapis.com/css?family=Inter:400,500,600,700&display=swap');

/* Palette taken from edu_dense_annotation: Ant Design blue for chrome, Bootstrap for
   button semantics. See STYLE.md for the mapping and the values it came from. */
:root {
  --bg: #f4f6fb;
  --surface: #fff;
  --subtle: #f8f9fa;
  --ink: #222;
  --muted: #666;
  --faint: #888;
  --line: #e0e0e0;
  --line-soft: #f0f0f0;
  --input-line: #ddd;

  --accent: #1890ff;
  --accent-hi: #40a9ff;
  --accent-bg: #e6f7ff;
  --accent-line: #b3e0ff;
  --accent-ink: #005a9e;

  --success: #28a745;
  --success-hi: #1e7e34;
  --danger: #dc3545;

  --student-bg: #f6fdf8;
  --student-ink: #237a45;
  --student-line: #b7e4c7;
  --narration-bg: #f5f5f5;
  --narration-ink: #888;

  --mark: #fff6d6;
  --mark-line: #ffc107;
  --mark-ink: #856404;
  --mark-strong: #fff3c4;

  --panel-shadow: 0 4px 24px rgba(24, 144, 255, .08);
  --lift-shadow: 0 4px 8px rgba(24, 144, 255, .3);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1 { font-size: 20px; font-weight: 600; letter-spacing: .2px; }
h2 { font-size: 16px; font-weight: 600; margin: 0; }
h3 {
  font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px;
  color: #495057; margin: 22px 0 10px;
}
.muted { color: var(--muted); }

/* ---------- header bar ---------- */

.header-bar {
  background: var(--accent);
  color: #fff;
  padding: 14px 24px 12px;
  border-radius: 0 0 12px 12px;
  box-shadow: 0 2px 8px rgba(24, 144, 255, .08);
  display: flex;
  align-items: center;
  gap: 16px;
}
.header-bar h1 { margin: 0; color: #fff; letter-spacing: .5px; }
.header-bar .grow { flex: 1; min-width: 0; }
.header-bar .instruction { margin: 0; font-size: 15px; font-weight: 600; color: #fff; }

.pill {
  font-size: 13px; font-weight: 500; color: rgba(255, 255, 255, .9);
  background: rgba(255, 255, 255, .1);
  padding: 3px 10px; border-radius: 16px;
  display: inline-block; white-space: nowrap;
  transition: all .2s ease;
}
.pill:hover { background: rgba(255, 255, 255, .2); }
.pill.on-light { color: var(--accent); background: var(--accent-bg); }

.header-bar .ghost {
  background: rgba(255, 255, 255, .12); color: #fff;
  border: 1px solid rgba(255, 255, 255, .25);
  padding: 6px 14px; border-radius: 6px;
  font-size: 12px; font-weight: 600;
  text-decoration: none; transition: all .2s ease;
}
.header-bar .ghost:hover { background: rgba(255, 255, 255, .22); transform: translateY(-1px); }

/* ---------- page shells ---------- */

.narrow { max-width: 760px; margin: 28px auto; padding: 0 20px; }
.wide { max-width: 1100px; margin: 28px auto; padding: 0 24px; }

.error { color: var(--danger); font-size: 13px; font-weight: 500; }
.quiet-btn {
  display: inline-block; background: #fff; border: 1px solid var(--input-line);
  color: var(--muted); padding: 8px 16px; border-radius: 6px;
  font-size: 12px; font-weight: 600; text-decoration: none;
}
.quiet-btn:hover { background: var(--subtle); border-color: #bbb; }

.card {
  background: var(--surface); border-radius: 16px;
  box-shadow: var(--panel-shadow);
  padding: 28px 32px;
}

.row { display: flex; align-items: center; gap: 12px; }
.spread { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 12px; max-width: 340px; }

a { color: var(--accent); }
code { font-size: 12px; color: var(--muted); }

/* ---------- controls ---------- */

button, input, textarea { font-family: inherit; }
button {
  cursor: pointer; border-radius: 6px;
  font-size: 12px; font-weight: 600;
  padding: 8px 16px; border: none;
  transition: all .2s ease;
}
button:disabled { cursor: not-allowed; opacity: .55; transform: none !important; box-shadow: none !important; }

.primary { background: var(--accent); color: #fff; }
.primary:hover:not(:disabled) { background: var(--accent-hi); transform: translateY(-1px); box-shadow: var(--lift-shadow); }

.commit { background: var(--success); color: #fff; }
.commit:hover:not(:disabled) { background: var(--success-hi); transform: translateY(-1px); box-shadow: 0 4px 8px rgba(40, 167, 69, .3); }

.quiet { background: #fff; border: 1px solid var(--input-line); color: var(--muted); }
.quiet:hover:not(:disabled) { background: var(--subtle); border-color: #bbb; }
.quiet.danger { color: var(--danger); }
.quiet.danger:hover:not(:disabled) { background: #fdf1f2; border-color: #f0b3b8; }

input[type=text], input:not([type]), textarea {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--input-line); border-radius: 6px;
  font-size: 13px; background: #fff; color: var(--ink);
  transition: border-color .2s ease, box-shadow .2s ease;
}
input:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(24, 144, 255, .1);
}
textarea { min-height: 72px; resize: vertical; line-height: 1.5; }

table { width: 100%; border-collapse: collapse; margin-top: 20px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line-soft); }
th {
  font-size: 12px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .5px; color: #495057;
}
tbody tr { transition: background .2s ease; }
tbody tr:hover { background: var(--subtle); }

/* ---------- workbench ---------- */

.workbench { height: 100vh; display: flex; flex-direction: column; }
.columns {
  flex: 1; min-height: 0;
  display: grid; grid-template-columns: minmax(0, 1fr) 420px;
  gap: 20px; padding: 20px 24px;
}

.transcript {
  overflow-y: auto; background: var(--surface);
  border-radius: 16px; box-shadow: var(--panel-shadow);
  padding: 18px 20px 60vh;
}
.panel {
  overflow-y: auto; background: var(--surface);
  border-radius: 16px; box-shadow: var(--panel-shadow);
  padding: 24px 22px 40vh;
}

/* ---------- transcript turns ----------
   Speaker sits in a fixed right-aligned gutter; the text itself is the tinted bubble,
   separated by a 2px gap rather than a divider. */

.turn { display: grid; grid-template-columns: 22px minmax(0, 1fr); margin-bottom: 2px; }
.turn-body {
  display: grid; grid-template-columns: 92px minmax(0, 1fr) 74px;
  gap: 10px; align-items: start;
}
.turn .meta {
  text-align: right; padding-top: 5px;
  font-size: 14px; font-weight: 600; color: var(--faint);
  line-height: 1.5; white-space: nowrap; user-select: none;
}
.turn .time {
  display: block; margin-top: 1px;
  font-size: 11px; font-weight: 500; color: var(--faint);
  font-variant-numeric: tabular-nums;
}
.turn .text {
  padding: 4px 8px; border-radius: 6px;
  border: 1px solid var(--line);
  white-space: pre-wrap; overflow-wrap: break-word;
  transition: all .2s ease;
}

.turn-tutor .text { background: var(--accent-bg); color: var(--accent-ink); border-color: var(--accent-line); }
.turn-student .text { background: var(--student-bg); color: var(--student-ink); border-color: var(--student-line); }
.turn-enrichment .text {
  background: var(--narration-bg); color: var(--narration-ink);
  border-color: var(--line); font-style: italic; font-size: 13px;
}

.turn:hover .text { filter: brightness(.975); }

.turn-actions { text-align: right; padding-top: 2px; }
.mark-btn {
  visibility: hidden;
  background: #fff; border: 1px solid var(--input-line); color: var(--muted);
  padding: 3px 10px; font-size: 11px; border-radius: 4px;
}
.mark-btn:hover { background: var(--subtle); border-color: #bbb; }
.turn:hover .mark-btn, .turn.marked .mark-btn { visibility: visible; }

/* A mark overrides the speaker tint so flagged turns stand out at a glance. */
.turn.marked .text, .turn.in-span .text {
  background: var(--mark); color: var(--ink);
  border-color: var(--mark-line);
  box-shadow: inset 3px 0 0 var(--mark-line);
}
.turn.selected .text { background: var(--mark-strong); }

.rail { display: flex; justify-content: center; padding-top: 9px; }
.rail-dot {
  width: 10px; height: 10px; border-radius: 50%; padding: 0;
  background: var(--mark-line); border: none;
}
.rail-dot:hover { transform: scale(1.15); }

.extending .transcript { cursor: crosshair; }
.extending .turn:hover .text { outline: 2px dashed var(--mark-line); outline-offset: 1px; }

.sentinel { height: 1px; }

/* ---------- questionnaire panel ---------- */

.hidden { display: none !important; }
.pill.warn { background: rgba(255, 255, 255, .22); color: #fff; font-weight: 600; }
.grow { flex: 1; min-width: 0; }

.panel-head { display: flex; align-items: baseline; justify-content: space-between; }
.panel-head h2 { color: var(--accent); }
.quote {
  margin: 8px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5;
  background: var(--subtle); border-left: 3px solid var(--line);
  border-radius: 0 6px 6px 0; padding: 8px 10px;
}
.saved { color: var(--success); font-size: 12px; font-weight: 600; opacity: 0; transition: opacity .2s; }
.saved.show { opacity: 1; }
.panel-tools { display: flex; gap: 8px; margin: 14px 0 4px; }
.empty-panel { color: var(--muted); margin-top: 36px; font-style: italic; }
.empty-panel strong { font-style: normal; }

.field { display: block; margin: 12px 0; }
.field > span {
  display: block; font-size: 13px; font-weight: 600;
  color: #333; margin-bottom: 6px;
}
.check {
  display: grid; grid-template-columns: 18px 1fr; gap: 8px;
  margin: 10px 0; align-items: start; cursor: pointer;
}
.check input { margin-top: 4px; }
.check em { display: block; font-style: normal; color: var(--muted); font-size: 13px; line-height: 1.45; }

/* ---------- wizard ---------- */

.step-indicator {
  margin: 14px 0 4px; font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .5px; color: #495057;
}
.wizard-footer {
  display: flex; align-items: center; gap: 8px;
  margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line-soft);
}
.hint { color: var(--muted); font-size: 13px; font-style: italic; margin: 8px 0 0; }

.qrow {
  padding: 10px 12px; margin-bottom: 8px;
  border: 1px solid var(--line-soft); border-radius: 8px; background: var(--subtle);
}
.qrow.unanswered { border-color: #ffe066; background: #fff9e6; }
.qtext { margin: 0 0 8px; font-size: 13px; font-weight: 500; color: #333; }
.yn { display: flex; gap: 14px; }
.yn-option { display: flex; align-items: center; gap: 5px; font-size: 13px; cursor: pointer; }

/* ---------- marks list ---------- */

.marks-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.mark-item {
  display: block; width: 100%; text-align: left;
  background: #fff; border: 1px solid var(--line-soft); border-radius: 8px;
  padding: 10px 12px; font-weight: 400;
}
.mark-item:hover { background: var(--subtle); border-color: var(--input-line); transform: translateY(-1px); }
.mark-item.incomplete { border-left: 3px solid var(--mark-line); }
.mark-item-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.mark-item-who { font-size: 13px; font-weight: 600; color: #333; }
.flag {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
  color: var(--mark-ink); background: var(--mark); padding: 1px 6px; border-radius: 4px;
}
.mark-item-cats { font-size: 12px; color: var(--accent); margin-top: 2px; }
.mark-item-quote {
  font-size: 12px; color: var(--muted); margin-top: 3px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Incomplete marks read differently in the transcript, so gaps show up while scrolling. */
.turn.marked.incomplete .text { border-style: dashed; }
.rail-dot.hollow { background: #fff; border: 2px solid var(--mark-line); }

/* ---------- admin ---------- */

.admin-transcript { margin-top: 20px; }

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  .columns { grid-template-columns: minmax(0, 1fr); }
  .panel { padding-bottom: 20vh; }
  .turn-body { grid-template-columns: 74px minmax(0, 1fr) 68px; }
}
