:root {
  color-scheme: light;
  --bg: #f4f2ec;
  --surface: #fffdf8;
  --surface-2: #f8f7f2;
  --text: #202124;
  --muted: #666b73;
  --line: #ded8ca;
  --accent: #0f766e;
  --accent-2: #c2410c;
  --accent-3: #365c9f;
  --danger: #b42318;
  --shadow: 0 18px 60px rgba(34, 29, 22, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.12), transparent 34%),
    linear-gradient(220deg, rgba(194, 65, 12, 0.1), transparent 36%),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 28px;
}

.workspace {
  display: grid;
  gap: 20px;
}

.topbar,
.result-head,
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar {
  min-height: 84px;
}

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

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.05;
}

h1 {
  font-size: clamp(36px, 5vw, 74px);
}

h2 {
  font-size: 24px;
}

h3 {
  font-size: 18px;
}

.status {
  min-width: 180px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(255, 253, 248, 0.7);
  color: var(--muted);
  text-align: center;
}

.status.ok {
  color: var(--accent);
}

.status.warn {
  color: var(--danger);
}

.input-grid {
  display: grid;
  grid-template-columns: minmax(360px, 0.9fr) minmax(420px, 1.1fr);
  gap: 20px;
}

.panel,
.insight {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.88);
  box-shadow: var(--shadow);
}

.panel {
  padding: 18px;
}

.transcript-panel {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 450px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 18px;
}

.field-row.compact {
  grid-template-columns: 1fr auto;
  align-items: end;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 13px;
  background: var(--surface);
  color: var(--text);
  outline: none;
}

textarea {
  min-height: 260px;
  resize: vertical;
  line-height: 1.5;
}

#transcriptMirror {
  min-height: 380px;
  margin-top: 14px;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.16);
}

.segmented {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface-2);
}

.segment {
  border: 0;
  padding: 9px 13px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.segment.active {
  background: var(--accent);
  color: white;
}

.mode-block {
  margin-top: 18px;
}

.hidden {
  display: none !important;
}

.dropzone {
  min-height: 190px;
  place-items: center;
  border: 1.5px dashed #b8b09f;
  border-radius: 8px;
  background: var(--surface-2);
  text-align: center;
}

.dropzone input {
  display: none;
}

.drop-title {
  display: block;
  color: var(--text);
  font-size: 18px;
  font-weight: 900;
}

.drop-subtitle {
  display: block;
  color: var(--muted);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.primary,
.ghost {
  min-height: 42px;
  border-radius: 8px;
  padding: 10px 15px;
  font-weight: 900;
}

.primary {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: white;
}

.ghost {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.progress {
  display: grid;
  gap: 8px;
  margin-top: 18px;
  color: var(--muted);
}

.progress-bar {
  height: 7px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--accent-3));
  background-size: 220% 100%;
  animation: move 1s infinite linear;
}

@keyframes move {
  from { background-position: 0 0; }
  to { background-position: 220% 0; }
}

.result {
  display: grid;
  gap: 20px;
}

.mindmap-wrap {
  position: relative;
  overflow: auto;
  min-height: 560px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.78);
  box-shadow: var(--shadow);
}

#mindmapLines,
#modalMindmapLines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.mindmap {
  position: relative;
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(280px, 360px) minmax(360px, 1fr);
  grid-auto-rows: minmax(88px, auto);
  align-items: start;
  gap: 18px 32px;
  min-width: 1320px;
  min-height: 760px;
  padding: 24px;
}

.map-center,
.map-branch {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 10px 28px rgba(24, 24, 24, 0.1);
}

.map-center {
  grid-column: 2;
  grid-row: 1 / span var(--branch-count, 6);
  align-self: center;
  position: sticky;
  top: 220px;
  width: 100%;
  min-height: 140px;
  display: grid;
  place-items: center;
  padding: 18px;
  background: #083f3b;
  color: white;
  font-size: 26px;
  font-weight: 950;
  text-align: center;
}

.map-branch {
  width: 100%;
  min-height: auto;
  padding: 16px;
}

.map-branch:nth-of-type(odd) {
  grid-column: 1;
}

.map-branch:nth-of-type(even) {
  grid-column: 3;
}

.map-branch:nth-of-type(1) { grid-row: 1; }
.map-branch:nth-of-type(2) { grid-row: 1; }
.map-branch:nth-of-type(3) { grid-row: 2; }
.map-branch:nth-of-type(4) { grid-row: 2; }
.map-branch:nth-of-type(5) { grid-row: 3; }
.map-branch:nth-of-type(6) { grid-row: 3; }
.map-branch:nth-of-type(7) { grid-row: 4; }
.map-branch:nth-of-type(8) { grid-row: 4; }
.map-branch:nth-of-type(9) { grid-row: 5; }
.map-branch:nth-of-type(10) { grid-row: 5; }

.map-branch h4 {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 18px;
}

.map-branch ul,
.insight ul {
  margin: 0;
  padding-left: 18px;
}

.map-branch li,
.insight li {
  margin: 8px 0;
  line-height: 1.38;
}

.map-tabs {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.map-tab {
  display: grid;
  gap: 3px;
  min-width: 170px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
}

.map-tab span {
  font-weight: 900;
}

.map-tab small {
  color: var(--muted);
  font-size: 12px;
}

.map-tab.active {
  border-color: var(--accent);
  background: #e9f5f2;
  color: var(--accent);
}

.insight-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.expert-tasks-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: rgba(255, 253, 248, 0.88);
  box-shadow: var(--shadow);
}

.expert-tasks-panel .panel-head span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.expert-tasks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.expert-task-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--surface);
}

.expert-task-card h3 {
  color: var(--accent);
  font-size: 17px;
}

.expert-task-card p {
  margin: 6px 0 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.expert-task-card ol {
  margin: 0;
  padding-left: 22px;
}

.expert-task-card li {
  margin: 7px 0;
  line-height: 1.35;
}

.insight {
  padding: 16px;
}

.insight.wide {
  grid-column: span 2;
}

.insight h3 {
  margin-bottom: 12px;
}

.tasks {
  display: grid;
  gap: 10px;
}

.task {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface-2);
}

.task strong {
  display: block;
}

.task span {
  color: var(--muted);
  font-size: 13px;
}

.priority {
  align-self: start;
  border-radius: 8px;
  padding: 4px 7px;
  background: #e9f5f2;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
}

pre {
  overflow: auto;
  white-space: pre-wrap;
  margin: 0;
  color: #2f3337;
  line-height: 1.5;
}

body.modal-open {
  overflow: hidden;
}

.map-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 12px;
  padding: 18px;
  background: rgba(244, 242, 236, 0.96);
}

.map-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.map-modal-head .actions {
  margin-top: 0;
}

.mindmap-wrap-full {
  min-height: 0;
  height: 100%;
  background: #fffdf8;
}

.mindmap-full {
  min-width: 1700px;
  min-height: 100%;
  grid-template-columns: minmax(460px, 1fr) minmax(340px, 420px) minmax(460px, 1fr);
  gap: 22px 44px;
}

.mindmap-full .map-center {
  width: 100%;
  min-height: 110px;
  font-size: 22px;
}

.mindmap-full .map-branch {
  width: 100%;
  padding: 18px;
}

.mindmap-full .map-branch h4 {
  font-size: 18px;
}

.mindmap-full .map-branch li {
  font-size: 15px;
}

@media (max-width: 980px) {
  .shell {
    padding: 18px;
  }

  .topbar,
  .result-head,
  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .input-grid,
  .field-row,
  .field-row.compact,
  .insight-grid {
    grid-template-columns: 1fr;
  }

  .insight.wide {
    grid-column: span 1;
  }

  .mindmap {
    min-width: 1100px;
  }

  .map-modal {
    padding: 10px;
  }

  .map-modal-head {
    align-items: flex-start;
    flex-direction: column;
  }
}
