@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;600;700&family=Source+Serif+4:opsz,wght@8..60,500;700&display=swap");

:root {
  color-scheme: light;
  --ink: #1f1c1a;
  --muted: #6c625a;
  --paper: #f7f2ea;
  --panel: #ffffff;
  --accent: #b2412a;
  --accent-dark: #822818;
  --accent-soft: #f4d5cc;
  --border: #e2d5c5;
  --shadow: rgba(28, 23, 18, 0.12);
  --note: #fef3d9;
  --note-border: #f0c674;
  --nav: #2b2521;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  background: #e6f6e6;
  color: var(--ink);
}
header {
  padding: 32px 8vw 10px;
}
h1 {
  font-family: "Source Serif 4", "Georgia", serif;
  font-size: 2.6rem;
  margin: 0 0 8px;
}
h2 {
  font-family: "Source Serif 4", "Georgia", serif;
  font-size: 1.8rem;
  margin: 0 0 12px;
}
h3 {
  font-size: 1.2rem;
  margin: 18px 0 8px;
}
main {
  padding: 0 8vw 80px;
  display: grid;
  gap: 20px;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 18px 40px var(--shadow);
}
.lead {
  color: var(--muted);
  max-width: 820px;
  line-height: 1.6;
}
.nav {
  background: var(--nav);
  color: #f7efe7;
  padding: 10px 8vw;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.nav a {
  color: inherit;
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 0.9rem;
}
.nav a.active,
.nav a:hover {
  border-color: #f7efe7;
  background: rgba(255, 255, 255, 0.1);
}
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}
.card-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(12em, 1fr));
}
.mini-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(140, 160, 200, 0.35);
  border-radius: 12px;
  padding: 12px;
  max-width: 13em;
  color: var(--muted);
}
.mini-card h4 {
  margin: 0 0 6px;
  color: var(--ink);
  font-size: 0.98rem;
}
.mini-card p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.45;
}
.list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.6;
}
.callout {
  background: var(--note);
  border: 1px solid var(--note-border);
  border-radius: 12px;
  padding: 12px 14px;
  margin: 10px 0;
}
.callout strong {
  display: block;
  margin-bottom: 6px;
}
.toc {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 8px;
  color: var(--muted);
}
.toc a {
  color: inherit;
  text-decoration: none;
}
.toc a:hover {
  color: var(--accent-dark);
}
.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f1ebe2;
  color: #6f5c50;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 8vw;
  background: #fff9f2;
  border-bottom: 1px solid var(--border);
}
.topbar.is-active {
  display: flex;
}
.topbar.is-collapsed {
  position: fixed;
  top: 12px;
  right: 16px;
  left: auto;
  padding: 6px;
  border-radius: 999px;
  background: rgba(255, 249, 242, 0.92);
  border: 1px solid var(--border);
  box-shadow: 0 8px 20px rgba(25, 20, 15, 0.18);
  gap: 0;
}
.topbar.is-collapsed .controls,
.topbar.is-collapsed .counts {
  display: none;
}
.topbar-toggle {
  border: none;
  background: #1b5e52;
  color: #fff;
  border-radius: 999px;
  padding: 6px 10px;
  font-weight: 700;
  cursor: pointer;
}
.topbar.is-active:not(.is-collapsed) .topbar-toggle {
  display: none;
}
.topbar .controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.topbar button {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  background: #fff;
  cursor: pointer;
  font-weight: 600;
  color: var(--accent-dark);
}
.topbar button.primary {
  background: #d97a1c;
  color: #fff;
  border-color: #d97a1c;
}
.topbar button.primary#talk-record {
  min-width: 110px;
}
.topbar button.is-disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.topbar button.is-active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.topbar .counts {
  display: flex;
  gap: 10px;
  align-items: center;
}
.count-chip {
  background: #f6e7db;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
  font-weight: 600;
  color: var(--accent-dark);
}

/* Standardized Talk counts (buttons injected by spec.js) */
.topbar .count {
  background: #f6e7db;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  min-width: 34px;
  text-align: center;
  cursor: pointer;
  font-weight: 600;
  color: var(--accent-dark);
}

/* Optional Tasks link if present in topbar controls */
.talk-task-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--accent-dark);
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 600;
}
.talk-task-link.has-needs-review {
  border-color: #c74646;
  background: #fff3f3;
}
.talk-task-badge {
  min-width: 16px;
  height: 16px;
  border-radius: 999px;
  background: #c74646;
  color: #fff;
  font-size: 10px;
  line-height: 16px;
  text-align: center;
  padding: 0 4px;
  font-weight: 700;
}

.global-nav-topbar {
  position: sticky;
  top: 0;
  z-index: 35;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 8px;
  padding: 10px 8vw 0;
  background: linear-gradient(180deg, rgba(230, 246, 230, 0.96) 0%, rgba(230, 246, 230, 0.7) 68%, rgba(230, 246, 230, 0) 100%);
  backdrop-filter: blur(8px);
}

.global-nav-topbar .nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(130, 40, 24, 0.16);
  background: rgba(255, 255, 255, 0.92);
  color: var(--accent-dark);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  box-shadow: 0 8px 18px rgba(28, 23, 18, 0.08);
  transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease, background 120ms ease;
}

.global-nav-topbar button.nav-btn {
  cursor: pointer;
  font-family: inherit;
}

.global-nav-topbar .nav-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(130, 40, 24, 0.28);
  background: #fff;
  box-shadow: 0 10px 22px rgba(28, 23, 18, 0.11);
}

.global-nav-topbar .nav-btn:focus-visible {
  outline: 2px solid rgba(178, 65, 42, 0.28);
  outline-offset: 2px;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(35, 27, 22, 0.72);
  display: none;
  z-index: 60;
}
.overlay.is-open {
  display: block;
}
.overlay-panel {
  position: absolute;
  inset: 40px 6vw 80px;
  background: #fffefb;
  border-radius: 16px;
  border: 1px solid var(--border);
  padding: 16px;
  overflow: auto;
}
.notes-overlay {
  position: fixed;
  inset: 0;
  background: rgba(24, 19, 15, 0.65);
  display: none;
  z-index: 70;
}
.notes-overlay.is-open {
  display: block;
}
.notes-panel {
  position: absolute;
  inset: 72px 6vw 40px;
  background: #fffdf9;
  border-radius: 16px;
  border: 1px solid var(--border);
  padding: 16px;
  overflow: auto;
}
.topic-section {
  position: relative;
  padding-top: 10px;
  margin-top: 18px;
  border-top: 3px solid var(--border);
}
.topic-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.topic-divider h4 {
  margin: 0;
  font-size: 1.05rem;
}
.topic-divider::after {
  content: "";
  flex: 1;
  height: 3px;
  background: var(--accent);
  border-radius: 999px;
}
.topic-mask {
  position: absolute;
  inset: 0;
  background: rgba(120, 120, 120, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
  pointer-events: all;
}
.topic-mask-label {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 14px;
  font-weight: 700;
  color: var(--accent-dark);
}
.raw-sticky {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fffdf9;
  padding-bottom: 8px;
}
.notes-panel h3 {
  margin-top: 0;
}

.uml {
  background: #f0f8ff;
  color: #e7ebf0;
  border: 1px solid #2a3140;
  border-radius: 12px;
  padding: 12px 14px;
  overflow: auto;
  font-size: 12px;
  line-height: 1.45;
}

.uml-img {
  width: 100%;
  max-width: 900px;
  display: block;
  border: 1px solid #2a3140;
  border-radius: 12px;
  background: #f0f8ff;
  margin: 10px 0 18px;
}

.diagram {
  margin-top: 12px;
}
.raw-list,
.topic-list {
  display: grid;
  gap: 10px;
}
.raw-card,
.topic-card {
  border: 2px solid #c7b9a9;
  border-radius: 12px;
  padding: 12px;
  background: #fff;
  position: relative;
  box-shadow: 0 2px 8px rgba(80, 60, 40, 0.08);
}
.topic-title {
  margin: 8px 0 6px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent-dark);
}
.raw-trash {
  position: absolute;
  top: 8px;
  right: 8px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 1rem;
  color: #a34646;
}
.raw-card textarea,
.topic-card textarea {
  width: 100%;
  min-height: 80px;
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 8px 10px;
  font-family: inherit;
}
.topic-card select.topic-template {
  width: 100%;
  margin: 6px 0;
  padding: 6px 8px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-weight: 600;
  color: var(--accent-dark);
}
.agent-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.agent-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  background: #fffaf2;
  display: grid;
  gap: 8px;
}
.agent-card h5 {
  margin: 0;
  font-size: 0.95rem;
}
.agent-card label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6a635e;
}
.agent-card textarea {
  width: 100%;
  min-height: 70px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  background: #fff;
}
.tag-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: #f2e9df;
  color: #6b5c52;
}
.tag-pill.refactor {
  background: #e9e6fb;
  color: #45357c;
}
.tag-pill.content {
  background: #f6efe5;
  color: #8a4a28;
}
.raw-meta {
  font-size: 0.82rem;
  color: var(--muted);
}
.inline-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.inline-actions button {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 999px;
  padding: 4px 10px;
  cursor: pointer;
  font-weight: 600;
  color: var(--accent-dark);
}
.inline-actions button.submit {
  background: #2f8f4e;
  border-color: #2f8f4e;
  color: #fff;
}
.inline-actions button.submit.is-pale {
  background: #b7d8c2;
  border-color: #b7d8c2;
  color: #2d5a3e;
}
.inline-actions button.park {
  background: #e0e0e0;
  border-color: #c8c8c8;
  color: #3b3b3b;
}
.inline-actions button.delete {
  background: #c74646;
  border-color: #c74646;
  color: #fff;
}
.inline-actions button.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.inline-actions button.record-extra,
.inline-actions button.record-content {
  background: #d97a1c;
  border-color: #d97a1c;
  color: #fff;
}
.inline-actions button.record-extra.is-recording {
  background: #c74646;
  border-color: #c74646;
  color: #fff;
}
.inline-actions button.refactor {
  background: #6b5bd8;
  color: #fff;
  border-color: #6b5bd8;
  min-width: 140px;
}
.processing {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--muted);
}
.processing::before {
  content: \"\";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.overlay-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  position: sticky;
  top: 0;
  background: #fffefb;
  padding-bottom: 8px;
  z-index: 2;
}
.task-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: #fff;
  margin-bottom: 10px;
}
.task-details-body {
  max-height: 15em;
  overflow: auto;
  padding: 6px 0;
}
.task-chat {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}
.task-chat .chat-line {
  padding: 6px 8px;
  border-radius: 10px;
  background: #f2ece3;
  border: 1px solid #e2d7c8;
  font-size: 0.9rem;
}
.task-chat .chat-line strong {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
}
.task-feedback {
  margin-top: 10px;
  border-top: 1px dashed var(--border);
  padding-top: 8px;
}
.task-feedback textarea {
  width: 100%;
  min-height: 80px;
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 8px 10px;
  font-family: inherit;
}
.task-meta {
  font-size: 0.85rem;
  color: var(--muted);
}
.task-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.task-actions button {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 999px;
  padding: 4px 10px;
  cursor: pointer;
  font-weight: 600;
  color: var(--accent-dark);
}

.marker {
  position: fixed;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px rgba(178, 65, 42, 0.35);
  pointer-events: none;
  z-index: 80;
}
.pin-highlight {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  box-shadow: 0 0 0 3px rgba(178, 65, 42, 0.22);
}

@media (max-width: 720px) {
  header {
    padding: 24px 6vw 8px;
  }
  h1 {
    font-size: 2.1rem;
  }
  .topbar {
    padding: 10px 6vw;
  }
  .overlay-panel {
    inset: 20px 4vw 60px;
  }
}
