.reasoning-graph-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 400px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 1.3rem 1.5rem 1rem;
  border-bottom: 1px solid color-mix(in oklch, var(--panel-border), transparent 40%);
  margin-bottom: 1rem;
  background: linear-gradient(180deg, color-mix(in oklch, var(--panel), var(--bg-strong) 8%) 0%, transparent 100%);
  border-radius: 1.3rem 1.3rem 0 0;
}

.panel-head-left {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.panel-head .eyebrow {
  margin: 0 0 0.3rem;
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.panel-head h2 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}

/* View Mode Switcher */
.view-mode-switcher {
  display: flex;
  gap: 0.5rem;
  background: color-mix(in oklch, var(--panel), var(--bg-strong) 25%);
  padding: 0.25rem;
  border-radius: 999px;
  border: 1px solid var(--panel-border);
}

.mode-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1rem;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-material);
  min-height: 36px;
}

.mode-btn:hover {
  background: color-mix(in oklch, var(--panel), var(--accent) 8%);
  color: var(--text);
}

.mode-btn.active {
  background: var(--accent);
  color: white;
  box-shadow: 0 2px 8px color-mix(in oklch, var(--accent), transparent 60%);
}

.mode-icon {
  font-size: 1rem;
  line-height: 1;
}

.mode-label {
  font-size: 0.82rem;
  font-weight: 500;
}

/* Reasoning Content Container */
.reasoning-content {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 0 1.5rem 1.5rem;
}

/* Sequential View */
.sequential-view {
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.sequential-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding-right: 0.5rem;
}

.sequential-item {
  display: flex;
  gap: 1rem;
  padding: 1rem;
  border-radius: 1rem;
  background: color-mix(in oklch, var(--panel), var(--bg-strong) 15%);
  border: 1px solid var(--panel-border);
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-material);
}

.sequential-item:hover {
  background: color-mix(in oklch, var(--panel), var(--accent) 8%);
  border-color: color-mix(in oklch, var(--panel-border), var(--accent) 30%);
  transform: translateX(2px);
  box-shadow: 0 4px 12px color-mix(in oklch, var(--accent), transparent 25%);
}

.sequential-item.selected {
  background: color-mix(in oklch, var(--panel), var(--accent) 14%);
  border-color: color-mix(in oklch, var(--accent), white 35%);
  box-shadow: 0 4px 16px color-mix(in oklch, var(--accent), transparent 50%);
}

.sequential-number {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.5rem;
  border-radius: 999px;
  background: var(--accent);
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
  flex-shrink: 0;
}

.sequential-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
}

.sequential-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.sequential-type {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  font-weight: 600;
}

.sequential-time {
  font-size: 0.75rem;
  color: var(--muted);
}

.sequential-title {
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sequential-reasoning {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.5;
  font-style: italic;
}

.sequential-branches {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: 0.2rem;
}

.branch-count {
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: color-mix(in oklch, var(--olive), white 85%);
  color: var(--olive);
  font-weight: 500;
}

/* Tree View */
.tree-view {
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.tree-container {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  background: color-mix(in oklch, var(--panel), var(--bg-strong) 8%);
  border-radius: 1rem;
  border: 1px solid var(--panel-border);
}

.tree-node-wrapper {
  margin-bottom: 0.25rem;
}

.tree-node {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.8rem;
  border-radius: 0.75rem;
  background: color-mix(in oklch, var(--panel), var(--bg-strong) 20%);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-material);
}

.tree-node:hover {
  background: color-mix(in oklch, var(--panel), var(--accent) 8%);
  border-color: color-mix(in oklch, var(--panel-border), var(--accent) 30%);
}

.tree-node.selected {
  background: color-mix(in oklch, var(--panel), var(--accent) 14%);
  border-color: color-mix(in oklch, var(--accent), white 35%);
  box-shadow: 0 2px 8px color-mix(in oklch, var(--accent), transparent 40%);
}

.tree-collapse-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.2rem;
  height: 1.2rem;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.7rem;
  cursor: pointer;
  transition: color var(--duration-fast) var(--ease-material);
  flex-shrink: 0;
}

.tree-collapse-btn:hover {
  color: var(--text);
}

.tree-node-marker {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 999px;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px color-mix(in oklch, var(--muted), transparent 70%);
}

.tree-node-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.tree-node-type {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  font-weight: 600;
}

.tree-node-title {
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.9rem;
}

.tree-children {
  margin-left: 1.2rem;
  padding-left: 0.5rem;
  border-left: 1px solid color-mix(in oklch, var(--panel-border), transparent 60%);
}

/* Graph View */
.graph-view {
  height: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
}

.graph-view svg {
  flex: 1;
  background: color-mix(in oklch, var(--panel), var(--bg-strong) 8%);
  border-radius: 1rem;
}

.graph-node {
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-material);
}

.graph-node circle {
  transition: all var(--duration-normal) var(--ease-material);
}

.graph-node:hover circle {
  filter: brightness(1.1);
  stroke-width: 2.5 !important;
}

.graph-controls {
  position: absolute;
  bottom: 1rem;
  right: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.8rem;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  box-shadow: var(--shadow-md);
}

.zoom-indicator {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 500;
}

/* Scrollbar styling for views */
.sequential-list::-webkit-scrollbar,
.tree-container::-webkit-scrollbar {
  width: 6px;
}

.sequential-list::-webkit-scrollbar-track,
.tree-container::-webkit-scrollbar-track {
  background: transparent;
}

.sequential-list::-webkit-scrollbar-thumb,
.tree-container::-webkit-scrollbar-thumb {
  background: color-mix(in oklch, var(--muted), transparent 60%);
  border-radius: 3px;
}

.sequential-list::-webkit-scrollbar-thumb:hover,
.tree-container::-webkit-scrollbar-thumb:hover {
  background: color-mix(in oklch, var(--muted), transparent 40%);
}

/* Responsive adjustments */
@media (max-width: 760px) {
  .panel-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .view-mode-switcher {
    width: 100%;
    justify-content: space-between;
  }

  .mode-btn {
    flex: 1;
    justify-content: center;
    padding: 0.5rem 0.8rem;
  }

  .mode-label {
    display: none;
  }

  .sequential-item {
    flex-direction: column;
    gap: 0.8rem;
  }

  .sequential-number {
    align-self: flex-start;
  }
}