:root {
  --bg: #f5f2ed;
  --surface: #ffffff;
  --surface-2: #ebe6dd;
  --ink: #17201b;
  --muted: #67706a;
  --line: #d7d0c4;
  --accent: #1d6f5f;
  --accent-2: #9a4f2e;
  --good: #16805d;
  --warn: #b35c1e;
  --bad: #b4232a;
  --shadow: 0 18px 50px rgba(33, 28, 20, 0.11);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px 22px;
  background: rgba(245, 242, 237, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 280px;
}

.mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: #fffaf2;
  font-weight: 800;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.brand h1 {
  font-size: 18px;
  line-height: 1.1;
}

.brand p {
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.tabs {
  display: flex;
  gap: 6px;
  padding: 5px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 9px 14px;
  border-radius: 7px;
  cursor: pointer;
  font-weight: 700;
}

.tab.active {
  color: #fff;
  background: var(--accent);
}

main {
  width: min(1520px, 100%);
  margin: 0 auto;
  padding: 22px;
}

.panel {
  display: none;
}

.panel.active {
  display: block;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 18px;
  align-items: start;
}

.script-area,
.assistant-panel,
.card,
.result-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.script-area,
.assistant-panel,
.card {
  padding: 18px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.section-head h2 {
  font-size: 22px;
}

.section-head.compact h2 {
  font-size: 18px;
}

.eyebrow {
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
  margin-bottom: 5px;
}

.status-chip {
  white-space: nowrap;
  border-radius: 999px;
  border: 1px solid rgba(29, 111, 95, 0.24);
  color: var(--accent);
  background: rgba(29, 111, 95, 0.08);
  padding: 8px 12px;
  font-weight: 800;
  font-size: 13px;
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.metric-strip div {
  background: #faf8f3;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  min-width: 0;
}

.metric-strip span,
.result-card span,
.approval-box span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 5px;
}

.metric-strip strong,
.result-card strong,
.approval-box strong {
  font-size: 20px;
}

.canvas-shell {
  background: #302d28;
  border-radius: 8px;
  overflow: hidden;
  min-height: 620px;
  display: grid;
  place-items: center;
  padding: 16px;
}

.image-stage {
  position: relative;
  width: min(100%, 850px);
}

#script-image {
  display: block;
  width: 100%;
  max-height: 72vh;
  object-fit: contain;
}

.annotation-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.annotation {
  position: absolute;
  border: 3px solid var(--good);
  color: #fff;
  background: rgba(22, 128, 93, 0.9);
  border-radius: 7px;
  font-size: 13px;
  font-weight: 900;
  padding: 4px 7px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
}

.annotation.warning {
  border-color: var(--bad);
  background: rgba(180, 35, 42, 0.9);
}

.assistant-panel {
  position: sticky;
  top: 88px;
  max-height: calc(100vh - 110px);
  overflow: auto;
}

.ghost-btn,
.primary-btn {
  border: 0;
  border-radius: 7px;
  padding: 10px 13px;
  font-weight: 800;
  cursor: pointer;
}

.ghost-btn {
  color: var(--ink);
  background: var(--surface-2);
}

.primary-btn {
  color: #fff;
  background: var(--accent);
}

.question-list {
  display: grid;
  gap: 12px;
}

.question-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
  background: #fbfaf7;
}

.question-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.question-top h3 {
  font-size: 15px;
}

.score-pill {
  flex: 0 0 auto;
  color: var(--accent);
  border: 1px solid rgba(29, 111, 95, 0.28);
  border-radius: 999px;
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 900;
}

.rubric {
  display: grid;
  gap: 6px;
  margin: 10px 0;
}

.rubric-row {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  gap: 8px;
  align-items: start;
  font-size: 13px;
  color: var(--muted);
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  margin-top: 4px;
  background: var(--bad);
}

.dot.good {
  background: var(--good);
}

.reason {
  color: var(--ink);
  background: #f0ece4;
  border-radius: 7px;
  padding: 10px;
  line-height: 1.45;
  font-size: 13px;
}

.override-form {
  display: grid;
  grid-template-columns: 92px 1fr auto;
  gap: 8px;
  margin-top: 10px;
}

.override-form input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 10px;
  background: #fff;
}

.approval-box {
  margin-top: 14px;
  padding: 14px;
  border-radius: 8px;
  background: var(--surface-2);
  display: grid;
  gap: 12px;
}

.note,
.muted {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.wide-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.card h2 {
  font-size: 24px;
  margin-bottom: 10px;
}

.mastery-list {
  display: grid;
  gap: 13px;
  margin-top: 18px;
}

.bar-row {
  display: grid;
  gap: 7px;
}

.bar-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-weight: 800;
  font-size: 14px;
}

.bar-track {
  height: 10px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: inherit;
}

.stack-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.list-item {
  border: 1px solid var(--line);
  background: #fbfaf7;
  border-radius: 8px;
  padding: 12px;
}

.list-item strong {
  display: block;
  margin-bottom: 4px;
}

.list-item p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.roi-layout {
  display: grid;
  grid-template-columns: 430px minmax(0, 1fr);
  gap: 18px;
}

.roi-form {
  display: grid;
  gap: 12px;
}

.roi-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.roi-form input {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 11px 12px;
  background: #fff;
  color: var(--ink);
}

.roi-results {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.result-card {
  padding: 24px;
  min-height: 170px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.result-card strong {
  font-size: 36px;
}

.pilot-card {
  max-width: 980px;
  margin: 0 auto;
}

.timeline {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 20px 0;
}

.timeline-step {
  background: #fbfaf7;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 15px;
}

.timeline-step span {
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 900;
}

.timeline-step h3 {
  margin: 6px 0;
}

.criteria-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.criterion {
  border-left: 4px solid var(--accent);
  background: #fbfaf7;
  padding: 12px;
  border-radius: 6px;
  font-weight: 700;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  background: var(--ink);
  color: #fff;
  padding: 12px 14px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  transform: translateY(80px);
  opacity: 0;
  transition: all 180ms ease;
  z-index: 40;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 1100px) {
  .workspace,
  .roi-layout {
    grid-template-columns: 1fr;
  }

  .assistant-panel {
    position: static;
    max-height: none;
  }

  .metric-strip,
  .wide-grid,
  .roi-results,
  .timeline,
  .criteria-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .brand {
    min-width: 0;
  }

  .tabs {
    overflow-x: auto;
  }

  main {
    padding: 12px;
  }

  .override-form {
    grid-template-columns: 1fr;
  }

  .canvas-shell {
    min-height: 420px;
  }
}
